1 line
1004 B
JSON
1 line
1004 B
JSON
{"name":"event.data","type":"property","title":"event.data","deprecated":null,"removed":null,"desc":"An optional object of data passed to an event method when the current executing handler is bound. ","categories":["events/event-object","version/1.1"],"entries":[{"return":"Object","signatures":{"added":"1.1"},"examples":{"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. ","html":"\n<button> 0 </button>\n<button> 1 </button>\n<button> 2 </button>\n<button> 3 </button>\n<button> 4 </button>\n\n<div id=\"log\"></div>\n","code":"\nvar logDiv = $( \"#log\" );\n\nfor ( var i = 0; i < 5; i++ ) {\n $( \"button\" ).eq( i ).on( \"click\", { value: i }, function( event ) {\n var msgs = [\n \"button = \" + $( this ).index(),\n \"event.data.value = \" + event.data.value,\n \"i = \" + i\n ];\n logDiv.append( msgs.join( \", \" ) + \"<br>\" );\n });\n}\n"},"longdesc":""}]} |