.die([eventType] [, handler]) removes handlers previously attached with .live() (since 1.3; no-arg form 1.4.1). It is the legacy counterpart to modern .off().
Remember
// Legacy (jQuery ≤ 1.8)
$("p").live("click", foo);
$("p").die("click", foo); // remove that handler
$("p").die("click"); // remove all live click handlers on "p"
$("p").die(); // remove all live handlers on "p"
// Modern equivalent
$(document).on("click", "p", foo);
$(document).off("click", "p", foo);
Only when reading or migrating pre-1.9 code that used .live().
Confirm the original bind used .live() with a specific selector.
Call .die() on the same selector string.
Optionally pass an event type, and optionally the exact handler function.
Prefer rewriting to .on() / .off() instead of keeping .die().
Form
Since
Role
.die()
1.4.1
Remove all .live() handlers for that selector
.die(eventType)
1.3
Remove live handlers for one event type
.die(eventType, handler)
1.3
Remove one specific live handler function
.die(events)
1.4.3
Map of event types (and optional handlers) to remove
Pseudocode
Pseudocode
handlers were stored under SELECTOR by .live()
call $(SELECTOR).die(optional EVENT, optional HANDLER):
find live handlers keyed by SELECTOR
if no args:
remove all of them
else if EVENT only:
remove live handlers for that EVENT
else:
remove only that HANDLER for EVENT
modern rewrite:
$(document).off(EVENT, SELECTOR [, HANDLER])
Reference
Cheat Sheet
Quick facts for legacy code reviews.
Topic
Detail
Returns
jQuery (chainable)
Added
1.3 · no-arg 1.4.1 · map 1.4.3
Deprecated
1.7
Removed
1.9
Pairs with
.live()
Modern pair
.on() / .off()
Selector rule
Must match the original .live() selector exactly
Try it
Live Preview
Modern .on() / .off() stand-in for the old .live() / .die() pair (works in current jQuery).
Click the sample paragraph after binding. True .die() demos are in Try It Yourself (jQuery 1.8.3).
Status
Ready — Run “bind”, then click the sample.
Code
jQuery Examples
Legacy patterns for reading old code. Prefer .off() in new projects. Try It Yourself runs on jQuery 1.8.3.
Example 1 — Remove All Live Handlers
No arguments — clear every .live() handler for that selector.
jQuery
$("p").live("click", function () {
$("#out").text("clicked");
});
$("p").die(); // all live handlers on "p" gone
$("p").die("click") → foo still runs
$("p.note").die("click") → foo stops
How It Works
Key. Live storage uses the exact selector string.
Mismatch."p" ≠ "p.note" as a lookup key.
Match. Call .die() with the same selector as .live().
Modern. Same idea — .off("click", "p.note") must match the .on() selector.
Edge Cases & Pitfalls
Common traps when reading or migrating .die() code.
removed
Missing on jQuery 1.9+
$(…).die is not a function means the page loaded a modern jQuery — rewrite to .off().
selector
Selector must match exactly
A different string than the original .live() call leaves the handler in place.
pair
Only removes .live() handlers
.die() does not remove .bind(), .delegate(), or .on() handlers.
reference
Anonymous functions are hard to die
To remove one handler, keep a named function reference — or use .die(eventType) to clear that type.
Compatibility
Browser Support
.die() existed from jQuery 1.3 to 1.8. It was deprecated in 1.7 and removed in 1.9. Current jQuery builds do not include it.
✓ Removed · jQuery 1.3–1.8
.die()
Not available in jQuery 1.9+. Use .off() with .on() for all new and upgraded projects.
RemovedUse .off() instead
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
.die()Removed 1.9
Bottom line: Historical API only. Migrate live/die pairs to on/off when you touch legacy code.
Analysis
Performance Notes
Approach
Cost
Best for
.off() on a close root
Low
Modern cleanup of delegated handlers
Keeping .live() / .die()
N/A
Blocked on jQuery 1.9+ — must migrate
Document-wide live handlers
Broader filtering
Prefer closer roots with .on()
There is no performance win to keeping .die() — the migration target is clearer roots and .off(), which also works on current jQuery.
Remember
Key Takeaways
Role: remove handlers attached with .live().
Status: deprecated 1.7, removed 1.9 — not in modern jQuery.
Migrate:.live() → .on(), .die() → .off().
Selector: must match the original .live() string exactly.
One line:.die() was the undo for .live() — learn it to read old code, write new code with .off().
Frequently Asked Questions
.die() removes event handlers previously attached with .live(). It is the unbind counterpart to .live(), similar to how .off() removes handlers attached with .on().
No. .die() was deprecated in jQuery 1.7 and removed in jQuery 1.9. Current jQuery 3.x builds do not include it. Use .off() instead. jQuery Migrate 1.x can restore .live()/.die() temporarily while upgrading.
Replace .live() with .on() on a root (often document), then replace .die() with .off(). Example: $('p').live('click', fn) → $(document).on('click', 'p', fn), and $('p').die('click') → $(document).off('click', 'p').
.live() stored handlers keyed by the selector string. .die() looks them up the same way. Binding with $('p.note').live('click', fn) requires $('p.note').die('click') — $('p').die('click') will not remove it.
It removes all handlers previously attached with .live() for that selector — a broad cleanup, similar to calling .off() with no filter on a modern delegated binding.
.die() removes document-level .live() handlers. .undelegate() removes handlers attached with .delegate() on a chosen root. Both are legacy; .off() replaces them in modern jQuery.