views:

44

answers:

1

Hi!

I'm trying to unbind a live event (have tried with .live and with .delegate).

When I want to unbind it I have 3 different options: unbind "click", unbind "click.namespace1" or unbind ".namespace1". They all do different things: first one unbind all click events (is not what I want), the second one unbind only the events at "click" with the namespace "namespace1" (again, is not what I want). The last one unbind all binded events with the namespace "namespace1", even if they are not "click", this is what I want.

When you use .unbind(".namespace1") it works perfectly for binded events with .bind. But when you use .die(".namespace1") or .undelegate(".namespace1") it does not work!!

Here is a sample: http://jsfiddle.net/uWxpv/8/

Please if someone know what can I do help me!

Thanks in advance,

Diego

A: 

The correct way to do this is:

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

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

Diego