jQuery event.data property
Example
For each
element, return the data passed through the on() method:
$("p").each(function(i){
$(this).on("click",{x:i},function(event){
alert("Index: " + $(this).index() + ". The paragraph's data is: " + event.data.x);
});
});
Try it »
Definition and Usage
The event.data property contains optional data passed to the event method when the currently executing handler was bound.
Syntax
event
.data
| Parameters | Description |
|---|---|
| event | Required.event The parameters come from the event binding function. |
jQuery event methods