开发者

how to retrieve onlick events added with click() [duplicate]

开发者 https://www.devze.com 2023-04-04 22:28 出处:网络
This question already has answers here: Closed 11 years ago. 开发者_StackOverflow社区 Possible Duplicate:
This question already has answers here: Closed 11 years ago. 开发者_StackOverflow社区

Possible Duplicate:

jQuery find events handlers registered with an object

How can you retrieve all onlick methods added with click()?


This will return an array of objects:

$(foo).data("events").click

Access the handler member to get the function:

$(foo).data("events").click[0].handler

JSFiddle: http://jsfiddle.net/Q7hdz/


From the docs:

jQuery itself uses the .data() method to save information under the names 'events' and 'handle'...

So Alnitak's warning below may apply.

0

精彩评论

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