control-freak-ide/Control-Freak-Documentation/jQuery/docs/entries/die.json
plastic-hub-dev-node-saturn 538369cff7 latest
2021-05-12 18:35:18 +02:00

1 line
2.4 KiB
JSON

{"name":"die","type":"method","title":".die()","deprecated":"1.7","removed":"1.9","desc":"Remove event handlers previously attached using <code>.live()</code> from the elements.","categories":["events/event-handler-attachment","version/1.3","version/1.4.1","version/1.4.3","deprecated/deprecated-1.7","removed"],"entries":[{"return":"jQuery","signatures":[{"added":"1.4.1"},{"added":"1.3","argument":[{"desc":"A string containing a JavaScript event type, such as <code>click</code> or <code>keydown</code>.","name":"eventType","type":"String"},{"desc":"The function that is no longer to be executed.","name":"handler","optional":"true","type":"String"}]},{"added":"1.4.3","argument":{"desc":"A plain object of one or more event types, such as <code>click</code> or <code>keydown</code> and their corresponding functions that are no longer to be executed.","name":"events","type":"PlainObject"}}],"examples":[{"desc":"To unbind all live events from all paragraphs, write:","code":"\n$( \"p\" ).die();\n"},{"desc":"To unbind all live click events from all paragraphs, write:","code":"\n$( \"p\" ).die( \"click\" );\n"},{"desc":"To unbind just one previously bound handler, pass the function in as the second argument:","code":"\nvar foo = function() {\n // Code to handle some kind of event\n};\n\n// Now foo will be called when paragraphs are clicked\n$( \"p\" ).live( \"click\", foo );\n\n// Now foo will no longer be called\n$( \"p\" ).die( \"click\", foo );\n"}],"longdesc":"\n <p>Any handler that has been attached with <code>.live()</code> can be removed with <code>.die()</code>. This method is analogous to calling <code>.off()</code> with no arguments, which is used to remove all handlers attached with <code>.on()</code>.\n See the discussions of <code>.live()</code> and <code>.off()</code> for further details.</p>\n <p>If used without an argument, .die() removes <em>all</em> event handlers previously attached using <code>.live()</code> from the elements.</p>\n <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=\"/off/\"><code>.off()</code></a> to remove event handlers bound with <a href=\"/on/\"><code>.on()</code></a></p>\n <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>\n "}]}