|
1 | 1 | <?xml version="1.0"?>
|
2 |
| -<entry type="method" name="die" return="jQuery" deprecated="1.7"> |
| 2 | +<entry type="method" name="die" return="jQuery" deprecated="1.7" removed="1.9"> |
3 | 3 | <title>.die()</title>
|
4 | 4 | <desc>Remove event handlers previously attached using <code>.live()</code> from the elements.</desc>
|
5 | 5 | <signature>
|
|
27 | 27 | <p><strong>As of jQuery 1.7</strong>, use of <code>.die()</code> (and its complementary method, <code>.live()</code>) is not recommended. Instead, use <a href="http://api.jquery.com/off/"><code>.off()</code></a> to remove event handlers bound with <a href="http://api.jquery.com/on/"><code>.on()</code></a></p>
|
28 | 28 | <p><strong>Note:</strong> In order for .die() to function correctly, the selector used with it must match exactly the selector initially used with .live().</p>
|
29 | 29 | </longdesc>
|
30 |
| - <category slug="events/event-handler-attachment"/> |
31 |
| - <category slug="version/1.3"/> |
32 |
| - <category slug="version/1.4.1"/> |
33 |
| - <category slug="version/1.4.3"/> |
34 |
| - <example> |
35 |
| - <desc>Can bind and unbind events to the colored button.</desc> |
36 |
| - <code><![CDATA[ |
37 |
| -function aClick() { |
38 |
| - $("div").show().fadeOut("slow"); |
39 |
| -} |
40 |
| -$("#bind").click(function () { |
41 |
| -$("#theone").live("click", aClick) |
42 |
| - .text("Can Click!"); |
43 |
| -}); |
44 |
| -$("#unbind").click(function () { |
45 |
| -$("#theone").die("click", aClick) |
46 |
| - .text("Does nothing..."); |
47 |
| -}); |
48 |
| -
|
49 |
| -]]></code> |
50 |
| - <css><![CDATA[ |
51 |
| -button { margin:5px; } |
52 |
| -button#theone { color:red; background:yellow; } |
53 |
| -]]></css> |
54 |
| - <html><![CDATA[<button id="theone">Does nothing...</button> |
55 |
| -<button id="bind">Bind Click</button> |
56 |
| -<button id="unbind">Unbind Click</button> |
57 |
| -
|
58 |
| -<div style="display:none;">Click!</div>]]></html> |
59 |
| - </example> |
60 | 30 | <example>
|
61 | 31 | <desc>To unbind all live events from all paragraphs, write:</desc>
|
62 | 32 | <code><![CDATA[$("p").die()]]></code>
|
|
0 commit comments