Skip to content

Instantly share code, notes, and snippets.

@Majkl578
Created October 2, 2012 20:02
Show Gist options
  • Select an option

  • Save Majkl578/3822948 to your computer and use it in GitHub Desktop.

Select an option

Save Majkl578/3822948 to your computer and use it in GitHub Desktop.
form's button that triggered submit (jQuery)
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
</head>
<body>
<form id="x">
<input type=submit name="a">
<input type=submit name="b">
</form>
<script>
$(function() {
$('#x').submit(function (e) {
console.log(e.originalEvent.explicitOriginalTarget.name);
return false; // for testing purposes
});
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment