as scott mentioned, i would strongly reading through the article.

But, just for fun here is a simple hack that could be useful.

$("#elem").unbind("click").bind("click", fnName);

this will unbind all the click event handlers from the provided element,
then bind ur new click event. this way you can be sure that the event doesnt
get bound multiple times.

hope that helps.
-GTG

On 6/25/07, SimonJanes <[EMAIL PROTECTED]> wrote:


Hello JQuery Enthusiasts!

I'm working on a web page with some tree code that periodically adds
new nodes to the tree.  When these new nodes/controls appear, I want
to bind their handlers to them.  At the moment, I'm doing general
selections to grab all the possible controls to bind 'click' or
'dblclick' to them.

How do I bind an event handler to an query with $().bind() without
chaining the event-- what I want to do is set the event handler only
if it wasn't already set for that matching element.   I don't want
that handler to be called twice (or three, four, etc times) for that
event.

--Simon


Reply via email to