View related events related to an item in jQuery

I am trying to check for events related to an element using the following syntax

$(item).data("events");

I also tried

$(item).data("events").change;  

I know for sure that the change event is connected, and if I do

$(item).attr("change") 

I see that an attribute with that name has been registered.

I use the syntax:

$(item).change(handler) 

to bind the event.

Why can't I get an object of my data (events)?

+3
source share
1 answer

The function $(item).dataallows you to have access to certain data, namely the data that you put there, and not to events related to jQuery.

Try:

$._data($(item)[0])

if it itemis a selector, if it is a reference to node, the code can be shortened to:

$._data(item)

, . .

+7

Source: https://habr.com/ru/post/1736693/


All Articles