jquery click trigger code example
Example 1: trigger a click on page load jquery
$("document").ready(function() {
$("button").trigger('click');
});
Example 2: trigger button click jquery
$("input").trigger("click");
Example 3: trigger click jquery
$("selector").click();
$("selector").trigger("click");
Example 4: jquery trigger
$( "#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" ] );