Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

jQuery event.data property

jQuery event.data property

jQuery event methods jQuery event methods

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 jQuery event methods