Is there any way using jQuery\'s .bind() and .trigger() calls to execute a user defined function (ex: save ()) and act upon the return from the method? For example:
<
You can also use jQuery builtin event.preventDefault() and event.isDefaultPrevented():
$("#aForm").bind ('save', function (event) {
return true;
// "return false" or "event.preventDefault()" have the same effect
}
});
and then:
var event = $.Event('save')
$("#aForm").trigger (event)
if (event.isDefaultPrevented() == false) {
doSomething ();
}