English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

jQuery event.data Property

jQuery Events

The event.data property contains optional data passed to the event method when the current executing handler is bound.

Syntax:

event.data

Example

Return the data passed by the on() method of each <button> element:

$("button").each(function(i){
  $(this).on("click", {value:i}, function(event){
    msg = ["button = " + $( this ).index(), "event.data.value = " + event.data.value,"i = " + i];
  });
});
Test and see‹/›

parameter value

parameterdescription
eventtheeventparameter comes from the event binding feature

jQuery Events