javascript - Find all onclick attributes and append a value to them -


I am trying to find all the elements with a onclick attribute and toggle the " () "Add" var original attribute = $ ('[onclick]'). Attr ('onclick'); $ ('[Onclick]') Attr ('onclick', original attribute + 'toggle ()');

Something is clearly wrong, but what?

$ ('[onclick]'). Attr ('onclick'); First will return a value for the mailing element.

All you need to do is try this for each element:

  $ ('[onclick]'). Each (function () {var $ this = $ (this); var originalAttribute = $ this.attr ('onclick'); $ This.attr ('onclick', original attribute + 'toggle');}) ;   



Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -