jquery trigger a click code example

Example 1: trigger button click jquery

$("input").trigger("click");

Example 2: trigger click jquery

$("selector").click(); //or
$("selector").trigger("click");

Example 3: 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" ] );