I have two html select boxes where items are moved from left to right, now I want to change the behavior such that elements are copied from right to the left. I tried Oject.clone(o) and .cloneNode(true) with prototype library. It cause my browser to hang,
Presently the code that moves elements from left to right is as follows,
$('left').appendChild($('right').options.item($('right').selectedIndex));
How do I change this such that there is a copy of elements from left to right, instead of actual moving.
Instead of
Object.clone()useElement.clone()Documentation: http://api.prototypejs.org/dom/Element/clone/