Hi there: For example, I have a HTML form with several input buttons,
<form action="/index.php" method="post">
<input type="hidden" name="hf" />
<input type="submit" id="apply_action" name="action" value="Apply">
<input type="submit" id="cancel_action" name="action" value="Cancel">
it's the current framework of a large web project. Once Submit button 'Apply' is clicked, it will map to a particular PHP function on the web server, and then return certain HTML code back; of course, once 'Cancel' is clicked, it will map to another PHP function.
Now, I would like to add some stuff before the original submit action when the 'Apply' is clicked. For example: I would like to add an javascript alert ("hello") before the original submit action is sent to the server? I dont know how to achieve this with Jquery? First of all, there are two submit actions for this form, value='Apply' or 'Cancel', I need to differentiate the action; Second, after alert('hello'), I still need the original form action='index.php' to be executed. Is there a jquery function for this purpose? Thanks!