Skip to content

Instantly share code, notes, and snippets.

@donabrams
Created February 11, 2011 21:50
Show Gist options
  • Save donabrams/823107 to your computer and use it in GitHub Desktop.
Save donabrams/823107 to your computer and use it in GitHub Desktop.
if submitting via javascript, the submit event is not triggered. This makes sure it works! jquery function FTW
$.fn.sureSubmit = function(func) {
this.bind("submit", func).each(function(i, d) {
if (!d._origSubmit) {
d._origSubmit = d.submit;
d.submit = function() {
func();
this._origSubmit();
};
} else {
var f2 = d.submit;
d.submit = function() {
func();
f2();
};
}
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment