您可以解除绑定到文档的 jQuery 函数吗?

Can you unbind a jQuery function that's bound to the document?

我想阻止此功能运行:

$(document).on("click",".filters", function(event) {
    $('.filters').removeClass('selectedFilter');
    $(this).addClass('selectedFilter');
    $('.filters div').not('.selectedFilter div').slideUp(200);
    $('.selectedFilter div').animate({opacity:"toggle",height:"toggle"},200);
});

我试过 $(".filters").unbind("click"),但没用,我猜是因为我一开始是如何触发它的?

尝试off instead of unbind

$(document).off("click", ".filters");

来自文档:

The .off() method removes event handlers that were attached with .on() and Event handlers attached with .bind() can be removed with .unbind()