如何使用书签删除内联onclick属性? [英] How can I remove an inline onclick attribute with a bookmarklet?
本文介绍了如何使用书签删除内联onclick属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有一个讨厌的网站,通过使用< div onclick =>
而不是来阻止尝试在新标签中打开 < a href =>
。我已经使用jQuery编写了一个bookmarklet,它创建了一个包装器< a>
标签并将其插入< div>
围绕其内容。
There is an annoying website out there that foils attempts to "open in new tab" by using <div onclick=>
instead of <a href=>
. I've written a bookmarklet, using jQuery, that creates a wrapper <a>
tag and inserts it within the <div>
around its content.
如何删除原始的onclick处理程序?
How can I remove the original onclick handler?
推荐答案
尚未提及:
$('#myId')[0].onclick = null; // remove the inline onclick() event
这篇关于如何使用书签删除内联onclick属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文