1 line
1.1 KiB
JSON
1 line
1.1 KiB
JSON
{"name":"event.delegateTarget","type":"property","title":"event.delegateTarget","deprecated":null,"removed":null,"desc":"The element where the currently-called jQuery event handler was attached.","categories":["events/event-object","events","version/1.7"],"entries":[{"return":"Element","signatures":{"added":"1.7"},"examples":{"desc":"When a button in any box class is clicked, change the box's background color to red.","code":"\n$( \".box\" ).on( \"click\", \"button\", function( event ) {\n $( event.delegateTarget ).css( \"background-color\", \"red\" );\n});\n"},"longdesc":"\n <p>This property is most often useful in delegated events attached by <a href=\"/delegate/\"><code>.delegate()</code></a> or <a href=\"/on/\"><code>.on()</code></a>, where the event handler is attached at an ancestor of the element being processed. It can be used, for example, to identify and remove event handlers at the delegation point.</p>\n <p>For non-delegated event handlers attached directly to an element, <code>event.delegateTarget</code> will always be equal to <code>event.currentTarget</code>.</p>\n "}]} |