Skilldrick Skilldrick - 1 year ago 119
Javascript Question

Can I remove inline event handlers using jQuery?

I have some HTML with an

attribute. I want to override that attribute using jQuery. Is there any way to remove the click handler using jQuery? Using unbind doesn't work.

Answer Source

Try the .removeAttr() function:

$(function() {

‚Äč jsfiddle demo.

Once you've got rid of the onclick attribute you could attach your own click handler.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download