I've seen this in situations where the event handlers may be applied 
more than once.  I got into the habit of doing 
$("#foo").unbind("click").click(function () {...});

I think the $.one() method is meant for this type of situation though. 
The docs say it will apply a handler that should only happen once for an 
element...

Shawn

Flesler wrote:
> I lost a couple of hours of my life wondering why would this happen, I
> was working on jQuery.Listen, and after binding, unbinding, and
> rebinding, the handler was being triggered twice.
> I finally came up with a case where that happens, only using jquery's
> binding methods:
> 
> $('#foo')
>         .click(function(){})
>         .mouseover(function(){})
>         .unbind('click')
>         .click(function(){
>              alert('click!!');
>         });
> 
> clicking on foo should alert once, but in my PC, it does twice ( FF
> and IE ).. is this a bug ? I'll open a ticket just in case... Ticket
> #1798. - http://dev.jquery.com/ticket/1798
> 
> Ariel Flesler
> 

Reply via email to