Can I remove inline event handlers using jQuery?

前端 未结 5 2168
夕颜
夕颜 2020-12-10 04:17

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 unb

5条回答
  •  星月不相逢
    2020-12-10 04:48

    Tried given options but worked partially as they removed one but not all.

    Instead I tried following chaining as workaround. I am using ver 1.4.2.

    jQuery("selector")
        .removeAttr("onclick").removeAttr("onmouseout").removeAttr("onmouseover");
    

提交回复
热议问题