JQuery unbind Live / Delegate Namespace Events

I am trying to unleash a live event (tried with .live and with .delegate).

When I want to untie it, I have 3 different options: unbind "click", unbind "click.namespace1"or unbind ".namespace1". They all do different things: first turn off all click events (this is not what I want), and the second will only cancel events in the β€œclick” with the namespace β€œnamespace1” (again, this is not what I want). The latter unbinds all related events with the namespace1 namespace, even if they are not click, this is what I want.

When you use .unbind(".namespace1"), it works great for related events .bind. But when you use .die(".namespace1")or .undelegate(".namespace1"), it will not work !!

Here is an example: http://jsfiddle.net/uWxpv/8/

Please, if someone knows what I can do, help me!

Thanks in advance,

Diego

+3
source share
1 answer

The correct way to do this is:

$(document).unbind(".namespace1");

Here you can try: http://jsfiddle.net/mPrsP/

+1
source

Source: https://habr.com/ru/post/1763791/


All Articles