Events are a huge part of javascript because so much of our javascript is triggered by the user’s actions. Quite frequently we will assign a listener to a link and immediately want the default click action stopped. For example:
$('myLink').addEvent('click',function(e) {
e.stop();
//do stuff
});
The above code works great but there’s one small hole I sometimes run [...]
Don't forget to follow me on Twitter and be sure to visit Script & Style for the best Javascript and CSS articles around!
Sponsor the David Walsh Blog and get your brand in front of several thousand users per day!
MooTools Tip: Event.stop
Related posts:
- Prevent Default Event Actions Using MooTools 1.2
- Event Delegation with MooTools
- Implementing jQuery-Like Event Syntax in MooTools
- MooTools Event Delegation
- Implement MooTools’ Elements.addEvent in jQuery