I believe this is a requirement -- that I not use remove -- because the elements I'm trying to move around all have form element observers attached directly to their children, and I am pretty sure this will mess me up. Please let me know if that's not true and I don't need to worry.

Here's a thumbnail of what's in the page:

div.captions
        form
                div.caption
                        input.start
                /div
                div.caption
                        input.start
                /div
                ...
        /form
/div

And there's more than one such group on the page. What I need to do is loop through the input.start elements in each div.captions group, and re-sort their parent divs inside the form so they appear in their start order. I want to fire this whenever a start time is updated, and I already have a custom event listener where I can slot that in.

My initial pass at this would be to get my collection:

$$('div.captions form').each(function(elm){
        var parent = elm;
        var list = elm.select('div.caption');
        list.sortBy( someMagicFunctionHere );
        list.each(function(el){
                parent.insert(el.remove());
        });
});

But if I do that, won't I kill the form element observers that are attached to my input.start elements?

Is there another way (maybe just a native DOM thing) to change the order of elements without removing them from the page in the process?

Thanks,

Walter

--
You received this message because you are subscribed to the Google Groups "Prototype 
& script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to