-
Notifications
You must be signed in to change notification settings - Fork 260
Expand file tree
/
Copy pathevent.delegateTarget.xml
More file actions
18 lines (18 loc) · 1.12 KB
/
event.delegateTarget.xml
File metadata and controls
18 lines (18 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<entry type='property' name="event.delegateTarget" return="Element">
<signature>
<added>1.7</added>
</signature>
<desc>The element where the currently-called jQuery event handler was attached.</desc>
<longdesc><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>
<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>
</longdesc>
<example>
<desc>When a button in any box class is clicked, change the box's background color to red.</desc>
<code><![CDATA[$(".box").on("click", "button", function(event) {
$(event.delegateTarget).css("background-color", "red");
}); ]]></code>
</example>
<category name="Event Object" slug="event-object"/>
<category name="Events" slug="events"/>
<category name="Version 1.7" slug="1.7"/>
</entry>