开发者

Inspect bound events attached to element in Jquery

I am attempting to inspect the events bound to an element using the following syntax

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

I have also tried

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

I know for certain that the 开发者_JAVA技巧change event is bound and if I do this

$(item).attr("change") 

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

I am using the syntax:

$(item).change(handler) 

to bind an event.

Why can't I get at my data("events") object?


The $(item).data function only lets you have access to certain data, namely data that you put there and not the events that jQuery has bound.

Try:

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

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

$._data(item)

I found this via reading source code. I consider it a debugging tool only.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜