Sys.EventHandlerList.removeHandler Method

Removes an event handler from an event in an EventHandlerList instance.

var e = new EventHandlerList();
e.addHandler(id, handler);
e.removeHandler(id, handler);


The ID for the event.


The handler to remove from the event.

Use the removeHandler method to remove an event handler from an event defined in an EventHandlerList object. If the event has only one handler when removeHandler is called, the event will continue to exist as a placeholder in the EventHandlerList instance.

The addHandler and removeHandler methods also enable you to dynamically change an event in a script component at run time. For example, you can remove a handler from the list during its execution so that it runs only the first time the event is raised.

The following example shows how to call the addHandler and removeHandler methods in a custom control. This is part of a larger example found in the EventHandlerList class overview.

// Bind and unbind to click event.
add_click: function(handler) {
    this.get_events().addHandler('click', handler);
remove_click: function(handler) {
    this.get_events().removeHandler('click', handler);