📜  触发点击 jquery - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:49.080000             🧑  作者: Mango

代码示例4
$( "#foo" ).on( "click", function() {
  alert( $( this ).text() );
});
$( "#foo" ).trigger( "click" );

$( "#foo" ).on( "custom", function( event, param1, param2 ) {
  alert( param1 + "\n" + param2 );
});
$( "#foo").trigger( "custom", [ "Custom", "Event" ] );