1 line
1.6 KiB
JSON
1 line
1.6 KiB
JSON
{"name":"event.stopImmediatePropagation","type":"method","title":"event.stopImmediatePropagation()","deprecated":null,"removed":null,"desc":"Keeps the rest of the handlers from being executed and prevents the event from bubbling up the DOM tree.","categories":["events/event-object","version/1.3"],"entries":[{"return":"","signatures":{"added":"1.3"},"examples":{"desc":"Prevents other event handlers from being called.","css":"\n p {\n height: 30px;\n width: 150px;\n background-color: #ccf;\n }\n div {\n height: 30px;\n width: 150px;\n background-color: #cfc;\n }\n","code":"\n$( \"p\" ).click(function( event ) {\n event.stopImmediatePropagation();\n});\n$( \"p\" ).click(function( event ) {\n // This function won't be executed\n $( this ).css( \"background-color\", \"#f00\" );\n});\n$( \"div\" ).click(function( event ) {\n // This function will be executed\n $( this ).css( \"background-color\", \"#f00\" );\n});\n","html":"\n<p>paragraph</p>\n<div>division</div>\n"},"longdesc":"\n <p>In addition to keeping any additional handlers on an element from being executed, this method also stops the bubbling by implicitly calling <code>event.stopPropagation()</code>. To simply prevent the event from bubbling to ancestor elements but allow other event handlers to execute on the same element, we can use <code><a href=\"/event.stopPropagation/\">event.stopPropagation()</a></code> instead.</p>\n <p>Use <code><a href=\"/event.isImmediatePropagationStopped/\">event.isImmediatePropagationStopped()</a></code> to know whether this method was ever called (on that event object).</p>\n "}]} |