forked from jquery/api.jquery.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathevent.data.xml
38 lines (36 loc) · 1.08 KB
/
event.data.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?xml version="1.0"?>
<entry type="property" name="event.data" return="Object">
<title>event.data</title>
<signature>
<added>1.1</added>
</signature>
<desc>An optional data map passed to an event method when the current executing handler is bound. </desc>
<longdesc/>
<example>
<desc>Within a <code>for</code> loop, pass the value of <code>i</code> to the <code>.on()</code> method so that the current iteration's value is preserved. </desc>
<html><![CDATA[
<button> 0 </button>
<button> 1 </button>
<button> 2 </button>
<button> 3 </button>
<button> 4 </button>
<div id="log"></div>
]]></html>
<code><![CDATA[
var logDiv = $("#log");
/* Note: This code is for demonstration purposes only. */
for (var i = 0; i < 5; i++) {
$("button").eq(i).on("click", {value: i}, function(event) {
var msgs = [
"button = " + $(this).index(),
"event.data.value = " + event.data.value,
"i = " + i
];
logDiv.append( msgs.join(", ") + "<br>" );
});
}
]]></code>
</example>
<category slug="events/event-object"/>
<category slug="version/1.1"/>
</entry>