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" ] );
1
2
3$('body').trigger('this_works', [{data: [1, 2, 3]}, 'something']);
4
5$('body').on('this_works', function (event, json, string) {
6 // parameter is stocked in json.data here.
7 console.log(event, json, string);
8});