Tuesday, September 9, 2014

Jquery:Call some other click event in a other function

<input type="button" id="saveUpdatedRows" value="Save" />

Simple button click function:This function will be called when save button is clicked.
$(function(){
$("#saveUpdatedRows").click(
   function(){
    //Write your logic
   }
);        

});

When you want to call same save button click function from some other function eg. like on pagination, on complete ..etc.

you can use the trigger function to trigger the click event on saveUpdatedRows function.
Code below:

$( "#saveUpdatedRows" ).trigger( "click" ); 

No comments: