如何使用 Mootools 删除“onclick”

How to remove “onclick” with Mootools

我想单击其他元素以在单击元素 a 时删除属性;

我这样使用 html:

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

而 JS 是这样的:

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

它不工作。我该如何解决这些问题。

Ethan 使用 jQuery 图书馆

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

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

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

用于删除属性的 MooTools API 是 Element:removeProperty,您可以这样使用:

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