How to remove inline onclick attribute using bookmarklet?

There is an annoying website that tries to β€œopen a new tab” using <div onclick=>instead <a href=>. I wrote a bookmarklet using jQuery, which creates a shell tag <a>and inserts it in <div>around its contents.

How to remove the onclick source handler?

+3
source share
2 answers

Not yet indicated:

$('#myId')[0].onclick = null; // remove the inline onclick() event
+5
source

Disabled, but ...

$("selector").removeAttr("onclick");

I think you already tried

$("selector").unbind("click");
+1
source

Source: https://habr.com/ru/post/1739489/


All Articles