As with attaching listeners, there are two browser variations for removing events and legacy browser considerations as well. Additionally, when using the native event removal functions, you must pass in exactly the same arguments as you passed to the native add event functions. YUI not only handles the cross-browser variations, but ensures that you pass the correct arguments when removing a function. This recipe shows several ways to remove event listeners from elements.
Remove a callback function directly, by passing in the exact same arguments you used when calling addListener:
YAHOO.util.Event.removeListener('myElementId', 'click', fnCallback);
Removing all events of a specific type does not require the arguments from addListener:
// removes all 'click' type events from 'myElementId' YAHOO.util.Event.removeListener('myElementId', 'click');
Remove all listeners from an element:
YAHOO.util.Event.purgeElement('myElementId');
Remove all listeners from...