如何使用Mootools删除“ OnClick”



我想单击其他元素以删除使用元素a;

的属性

我像这样使用了html:

<a href="#" data-value="all"  class="search-item" onclick="showCat(this)">全部商品</a>

和js这样:

$$(".search-item").remove("click",showCat);

它不起作用。我如何解决这些问题。

删除属性的mootools api是 Element:removeProperty,您可以这样使用:

$$(".search-item").removeProperty("onclick");

Ethan使用jQuery库

  jQuery('.search-item').removeProp('onClick').unbind('click')

您可以删除这样的元素的属性:

$$(".search-item").setProperty("onclick", null);

最新更新