Reputation: 13
I want to click other element to remove attribute on click with element a ;
I used html like this:
<a href="#" data-value="all" class="search-item" onclick="showCat(this)">全部商品</a>
And JS like this:
$$(".search-item").remove("click",showCat);
it is not working. How can I fix those problems.
Upvotes: 1
Views: 240
Reputation: 28845
MooTools API for removing attributes is Element:removeProperty
, and you can use like this:
$$(".search-item").removeProperty("onclick");
Upvotes: 1
Reputation: 176
You can remove element's attribute like this:
$$(".search-item").setProperty("onclick", null);
Upvotes: 0
Reputation: 21
Ethan use jQuery library
jQuery('.search-item').removeProp('onClick').unbind('click')
Upvotes: 0