Created
March 10, 2009 04:33
-
-
Save duncanbeevers/76725 to your computer and use it in GitHub Desktop.
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> | |
<title>Form Submit Test</title> | |
<script src="http://www.google.com/jsapi"></script> | |
<script> | |
// Load prototype | |
google.load("prototype", "1.6.0.3"); | |
google.setOnLoadCallback(function() { | |
var form = $('myform'), | |
original_submit = form.submit; | |
form.submit = function(event) { | |
if (form.onsubmit && form.onsubmit()) { original_submit.apply(this, arguments); } | |
}; | |
}); | |
</script> | |
</head> | |
<body> | |
<form action="#" method="POST" id="myform" onsubmit="alert('form submitted'); return false;"> | |
<input type="submit" name="Submit via input type submit" /> | |
</form> | |
<button onclick="$('myform').submit()">Submit via javascript</button> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment