Use a variable? var buttonClicked = '';
$("#delete").click(function(){ buttonClicked ='delete'; ..... }) $("#view").click(function(){ buttonClicked ='view'; ..... }) submitHandler: function(form) { if(buttonClicked == 'delete') {//do delete} else if (buttonClicked == 'view') {//do view} } } On Oct 24, 6:20 am, mathie <trung...@gmail.com> wrote: > Hello, > > I have a form with two buttons: "Delete" and "View". A checkbox is > required for all actions. Validation happens when a button is clicked. > If it's "View", it is just a normal operation. However, if it's > "Delete", if the form is valid, it then needs to show a confirmation > before form submission via custom handler (submitHandler). > > submitHandler: function(form) { if (confirmDelete()) { form.submit > (); } } > > Problem: How do I know if the button is Edit or Delete inside > submitHandler? The function above open the dialog even for "View" > button. > > Thanks for any suggestion.