I have some HTML with an onclick 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.
onclick
Try the .removeAttr() function:
.removeAttr()
$(function() { $('a').removeAttr('onclick'); });
? jsfiddle demo.
Once you've got rid of the onclick attribute you could attach your own click handler.
1.4m articles
1.4m replys
5 comments
57.0k users