:O I'm not sure about it. But I thought it was faster to clone and then remove, than move it all. Thanks for taking your time to explain this.
On 9/12/07, Pyrolupus <[EMAIL PROTECTED]> wrote: > > > On Sep 11, 7:06 pm, "Joan Piedra" <[EMAIL PROTECTED]> wrote: > > Hmm.. Can't you clone the nodes and then just remove the _old_ parent > div? > > Sure, but if I'm not mistaken, using clone() is more expensive: it > creates copies of everything just to subsequently remove the > originals. By using children(), we just work with the same number of > DOM elements, just change their root. (This is based on an untested > assumption that the browser is re-linking existing items, not doing > its own internal clone-then-delete type behavior.) > > In either case, though, the old parent div does get removed. > > Pyro > > > > > On 9/11/07, Pyrolupus <[EMAIL PROTECTED]> wrote: > > > > > On Sep 11, 3:03 pm, "Brook Davies" <[EMAIL PROTECTED]> wrote: > > > > Easy Question I think. If I use (from Jquery 1.2): > > > > > > $("#myElem").wrapAll("<div id='myDiv'></div>"); > > > > > > To wrap the div 'myDiv' around 'myElem', how can I later remove that > div > > > > without removing the pre-existing myElem and any other contents of > that > > > div? > > > > > I'm newish to jQuery, so my syntax is not the uberest, but something > > > like the following would work: > > > > > $('div#myDiv').after($('div#myDiv').children()).remove() > > > > > In fact, it does work--I just tested it in FireBug. (I just don't > > > know the correct syntax to avoid referring to div#myDiv twice.) > > > > > Pyro > > > > -- > > Joan Piedra || Frontend web developerhttp://www.justaquit.com/ || > http://www.joanpiedra.com/ > > -- Joan Piedra || Frontend web developer http://www.justaquit.com/ || http://www.joanpiedra.com/