I stumbled upon this thread because I have recently switched to jQuery. When writing an event function in MooTools, you can simple call evnt.stop(). jQuery does not implement such a function.
Here is the solution that I extracted from MooTools. Because it is taken directly from the MooTools source code, I trust that it is cross-compatible:
Code:
function stopEvent(e) {
if (e.stopPropagation) e.stopPropagation();
else e.cancelBubble = true;
if (e.preventDefault) e.preventDefault();
else e.returnValue = false;
}
In jQuery, you can utilize this function like so:
Code:
$('#emailform').submit(function(e) {
stopEvent(e);
I suspect that with basic JavaScript, you can still use a variable in the function definition and it represents the event, but I'm not totally positive:
Code:
<form onsubmit="doSomething" action="..." >
...
function doSomething(e) {
stopEvent(e);
//Your custom event function
}
By the way... you're all wrong! Doing "return false" will only get you so far. If you want to re-write the submit event function, you will need to do something like this.