jQuery重写事件
问题描述:
我有这样的主播
<a href='#' onclick='return showform(this)'>click me</a>
但是我希望能够覆盖onclick函数,如何在jquery中做到这一点?
But I want to be able to override the onclick function, how to do this in jquery?
因为好像我添加了
$('a').click( function() { alert('hi there!'); } );
新的点击处理程序不会取代旧的点击处理程序
the new click handler is not overriding the old one
答
您是否尝试过以下方法:
Have you tried something like this:
$("a").removeAttr("onclick");