O'Reilly logo

MooTools 1.3 Cookbook by Jay Larry G. Johnston

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Removing one of multiple event listeners

Getting ready

Keep in mind that mybutton is the trigger for our actions in this recipe.

<input type="button" id="mybutton" value="Greet Me!"/>

How to do it...

Continuing from the previous recipe where we have associated both click and mouseover actions to a triggering INPUT button, we prepare to remove some, but not all, events.

$('mybutton').removeEvents('mouseover');

How it works...

The object function Element.removeEvents() when used without any optional arguments will remove all events bound to an element. Passing in the single argument "mouseover" causes all events bound to that event action to be removed. This allows for the onClick() action previously bound to continue to function while preventing the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required