0

I have a sortable list (done using prototype and scriptaculous): you can sort its elements or drag them into another list.

When I drop the element (let's call it ELEMENT_1) of a list into another one what I do is a 'clone' of the dropped element and then I insert (appendChild) it into the new list.

ELEMENT1 had some 'observe' (clicking on it do something, double-clicking on it do something else) that are of course lost when I do the cloning.. I want the cloned element to have the same 'observe' of ELEMENT1.

How can I do that?

Thanks in advance

Paul R
  • 208,748
  • 37
  • 389
  • 560
AldoB
  • 381
  • 1
  • 6
  • 15

1 Answers1

0

Observe the lists instead of their items and allow event bubbling to do the work for you.

$('list1','list2').invoke('on', 'click', 'li', function(event, element){
    // "this" is either list1 or list2
    // "element" is the list item
}
clockworkgeek
  • 37,650
  • 9
  • 89
  • 127