javascript - jQuery check if onClick exists on element -


I found the way but it does not work on events that have not been delegated by jQuery ... < / P>

When I try,

  $ ("a"). Data ("events");  

For this.

  & lt; A href = "#" onClick = "warning ('hello, world!')" / & Gt;  

It's essentially back.

Is there any way to check that elements with onClick exist with jQuery?

Thank you.

You can do this:

  if ($ (' A '). Attr ("onClick")! = Undefined) {} ​​ 

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

jquery - SimpleModal Confirm fails to submit form -