Created
October 2, 2012 20:02
-
-
Save Majkl578/3822948 to your computer and use it in GitHub Desktop.
form's button that triggered submit (jQuery)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <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