Yea, use clone(true) to copy the events.

If you are using jQuery 1.3 beta you can try to use

$(selector).live('event', function(){

});

live is like bind just that new nodes added to DOM will inherit the
event.

Well, this is a trick call event delegation.


On Dec 29, 2:40 pm, Ricardo Tomasi <ricardob...@gmail.com> wrote:
> Didn't look at the source, but have you tried $(element).clone(true) ?
> That sets 'deep copying' and should copy all the event handlers with
> it.
>
> On Dec 29, 11:33 am, "nikla...@googlemail.com"
>
> <nikla...@googlemail.com> wrote:
> > Hello,
>
> > I don't know wether it is the right place for this question but I am
> > going to ask it anyway. I used jquery on my site and I registered a
> > function on all of the nodes of a certain class like this:
>
> > $('.up').click(function(){
> >    /* do stuff*/
>
> > });
>
> > The interesting thing about it is that this assignment of the function
> > to the event only appears to work with some of the elements. I have a
> > div container on the left containing elements classed ".up". If ".up"
> > is clicked I then go, clone the element and put it into what I call
> > the "shopping trolley" on the right. Now since I have cloned the node
> > which contains a ".up" classed element I would think that after
> > cloning the clone does inherit the event assignment. But oddly it does
> > not seem to. And it gets even more obsurd. If I then go and try to
> > reassign the event to the copied node, it still does not call the
> > assigned function when ".up" on the right side is clicked.
>
> > You can have a look at the source 
> > athttp://niklas.bplaced.net/dev/php/gallery.php
>
> > Your help is very much appreciated.
>
> > Greetings Niklas

Reply via email to