July 2011
Intermediate to advanced
276 pages
5h 11m
English
To release an element from our beck and call when it is no longer needed, we need to have first added an event to it. Since we start this recipe with the Hello World from the previous one, we are ready to remove the event.
We still keep in mind that mybutton will be triggering the action in this recipe.
<input type="button" id="mybutton" value="Greet Me!"/>
First, add a widget called mycancel and provide an onclick attribute that handles the click event. This bound function uses the MooTools Element.removeEvents() without the optional argument of which types of events to remove and therefore removes them all.
<input type="button" id="mycancel" value="Okay, nevermind" onclick=" ...