Name

Element.detachEvent( ): delete an event listener — IE 4:

Synopsis

void detachEvent(Stringtype,
                 Function listener)

Arguments

type

The type of event for which the event listener is to be deleted, with an “on” prefix. For example: “onclick”.

listener

The event-listener function that is to be removed.

Description

This method undoes the event-handler function registration performed by the attachEvent( ) method. It is the IE-specific analog to removeEventListener( ). To remove an event handler function for an element, simply invoke detachEvent with the same arguments you originally passed to attachEvent( ).

This method is also defined by, and works analogously on, the Document and Window objects.

Get JavaScript: The Definitive Guide, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.