Skip to content

Instantly share code, notes, and snippets.

@joshuaclayton
Created June 8, 2009 19:14
Show Gist options
  • Save joshuaclayton/126005 to your computer and use it in GitHub Desktop.
Save joshuaclayton/126005 to your computer and use it in GitHub Desktop.
$("form").each(function(idx, form) {
var onsubmit = $(form).attr("onsubmit");
if(typeof(onsubmit) !== undefined) {
$(form).removeAttr("onsubmit"); // this properly removes the attribute; nothing within this is triggered
$(form).submit(function() {
alert("submitted!"); // this doesn't get called
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment