Binding a function on document all element having class SearchableCol

jQuery(document).on("click", ".SearchableCol", nwcsClickFunc);

I am trying below two methods to unbind, nothing is working.

jQuery(document).unbind("click", nwcsClickFunc);
jQuery(".SearchableCol").unbind("click");

Need help to unbind an event from document.

有帮助吗?

解决方案

Try

jQuery(document).off("click", ".SearchableCol", nwcsClickFunc);

or use namespaced event handlers

jQuery(document).on("click.myevent", ".SearchableCol", nwcsClickFunc);

then

jQuery(document).off("click.myevent", ".SearchableCol");

其他提示

jQuery(document).off("click", ".SearchableCol", nwcsClickFunc);

use:

$(".SearchableCol").unbind('click',nwcsClickFunc);

or

$(document).off('click','.SearchableCol',nwcsClickFunc);
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top