Anil
Anil

Reputation: 3752

Unbind an event from Document : jquery

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.

Upvotes: 4

Views: 9041

Answers (3)

Milind Anantwar
Milind Anantwar

Reputation: 82251

use:

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

or

$(document).off('click','.SearchableCol',nwcsClickFunc);

Upvotes: 1

Arun P Johny
Arun P Johny

Reputation: 388446

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");

Upvotes: 10

Spokey
Spokey

Reputation: 10994

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

Upvotes: 3

Related Questions