Given the following HTML file:
<!DOCTYPE html5>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#form').submit(function(e) {
// put your breakpoint here to look at e
alert('Which button was clicked?');
});
});
</script>
</head>
<body>
<form id="form">
<input name="text" type="text"><br/>
<input name="commit" type="submit" value="Save"/>
<input name="commit" type="submit" value="Cancel"/>
</form>
</body>
I need to know which button was clicked by the submit handler method. Using the $.click
handler WILL NOT DO. If I can't do it using the $.submit
handler, then just say so.