.die()
**REMOVED**
JQ Home <<
Events <<
.die()
Remove event handlers.
Description
The .die()
method is used to remove event handlers from elements that were previously attached using the .live()
method.
- Without any parameters the
.die()
method unattaches all event handlers previously attached using the.live()
method. - For the
.die()
method to function correctly the selector used must exactly match the selector used when attaching the handlers using the.live()
method. - Starting with jQuery version 1.7 more flexible event delegation can be achieved by using the
.on()
and.off()
methods. The.on()
method allows us to attach event handlers directly to a document and is the preferred method to use when using this version onwards.
This method was deprecated in jQuery 1.7 and removed in jQuery 1.9 and we are just showing it for completeness.
- Use .on() instead.
Syntax
Signature | Description |
---|---|
.die() | Remove all handlers attached with the .live() method. |
.die( eventType [, handler] ) | Remove an event handler previously attached using the .live() method from the elements. |
.die( eventTypes ) | A map of event type(s) and previously bound functions attached with the .live() method to unattach from. |
Parameters
Parameter | Description | Type |
---|---|---|
eventType | A string containing one or more DOM event types or custom event names.
| String |
handler | A function to unattach from. | Function |
eventTypes | An object of event type(s) and previously bound functions to unattach from. | Object |
Return
A jQuery
object.
Related Tutorials
jQuery Advanced Tutorials - Lesson 4 - Event Handler Attachments