这是代码:
.on(clickEvent, 'button', function() {
console.log(Date());
})
.one(clickEvent, '.js-clear-all-actions', function() {
_(this)
.off()
.unbind()
.on(clickEvent, function(e) {
e.preventDefault();
})
.displayLoading(0);
})
.HTML:
<button class="large-button expand af-non-animated js-prevent-double-click" type="submit">
</button>
试图清除所有绑定的内容,但即使是之前绑定的事件仍然存在。请注意:我故意避免只添加禁用的属性,所以请我只想.off()
工作。
试试这个人:http://codepen.io/anon/pen/EKZMbe?editors=1010
$("#theButton").one("click", function(e) {
e.preventDefault();
console.log(Date());
});
如果您的最终目标是仅单击一次按钮,则可能会解决您的问题。让我知道:)