1$( "#foo" ).on( "click", function() {
2 alert( $( this ).text() );
3});
4$( "#foo" ).trigger( "click" );
5
6$( "#foo" ).on( "custom", function( event, param1, param2 ) {
7 alert( param1 + "\n" + param2 );
8});
9$( "#foo").trigger( "custom", [ "Custom", "Event" ] );