[jQuery] Re: Binding of object

2009-07-21 Thread Liam Potter
I'm a bit confused, how many functions are you trying to run onclick of #login? sken wrote: Hey, is it possible to get the binding of an object. Let`s say i do $(#login).click(function); so the next time i call $(#login) i want to check if a click event is already bind to that obejct. So

[jQuery] Re: Binding of object

2009-07-21 Thread sken
The click event should only trigger ONE function. I use a lot of ajax content and for some reason, it happens that on one object (#login) there a several click bindings. It's not visible for the user but in the console. So i would be nice if there would be some kind of check like var test

[jQuery] Re: Binding of object

2009-07-21 Thread Liam Potter
well, if there is only one function binded to the object, and only will be one, why do you need to check if there is an event bound to it? sken wrote: The click event should only trigger ONE function. I use a lot of ajax content and for some reason, it happens that on one object (#login)

[jQuery] Re: Binding of object

2009-07-21 Thread sken
there are several click binding. so the function is triggered several times. the function gets ajax content instead of getting this content only once the ajax request is done several times

[jQuery] Re: Binding of object

2009-07-21 Thread Liam Potter
can you show me your code, as I'm still struggling to understand just what you are trying to achieve. Why would you bind several clicks to the object, all running the one function? sken wrote: there are several click binding. so the function is triggered several times. the function gets

[jQuery] Re: Binding of object

2009-07-21 Thread sken
I don't do this intentionally. I DON'T want to bind several click bindings on the object. Therefore i was just curious if there is a check function to find out if there is already a binding. Why would you bind several clicks to the object, all running the one function? That's my point. I DON'T

[jQuery] Re: Binding of object

2009-07-21 Thread Liam Potter
ok, I think I understand now, there is no check binding function or plugin that I know off. If I have understood you correctly then this is how I would go about it. I would check if a variable onclick is set, if found to not of been set, run through the ajax, and on the ajax callback, set

[jQuery] Re: Binding of object

2009-07-21 Thread sken
Would make sense but i think i go with my unbind solution ... thanx for your help.

[jQuery] Re: Binding of object

2009-07-21 Thread Liam Potter
Well the way you do it would really do anything, it will just unbind, then run the function again as it is chained? sken wrote: Would make sense but i think i go with my unbind solution ... thanx for your help.

[jQuery] Re: Binding of object

2009-07-21 Thread Eric Garside
In what situation in your code would more than a single event be bound to the element? On Jul 21, 11:22 am, Liam Potter radioactiv...@gmail.com wrote: Well the way you do it would really do anything, it will just unbind, then run the function again as it is chained? sken wrote: Would

[jQuery] Re: Binding of object

2009-07-21 Thread Ricardo
Having click handlers added repeteadly is a sign of bad structure in your code. You should refactor your code to avoid that in the first place, that should'nt be happening. That said, there is a way to check for event handlers: var $login = $('#login'); if ( jQuery.data( $login[0],