[Javascript] .appendParent
Terry Riegel
riegel at clearimageonline.com
Tue Nov 18 08:55:05 CST 2008
Wow, that was fast.
Thank you very much.
Terry
On Nov 18, 2008, at 9:52 AM, David Dorward wrote:
> Terry Riegel wrote:
>> <div id="main">
>> blah...
>> </div>
>
>> Is there a way to appendParent to get something like
>>
>> <div id="appendage">
>> <div id="main">
>> blah...
>> </div>
>> </div>
>
> Insert the wrapper before the existing content, then move the existing
> content inside it.
>
> var main = document.createElementById('main');
> var appendage = document.createElement('div');
>
> main.parentNode.insertBefore(appendage, main);
> appendage.appendChild(main);
>
>
> --
> David Dorward <http://dorward.me.uk/>
> _______________________________________________
> Javascript mailing list
> Javascript at lists.evolt.org
> http://lists.evolt.org/mailman/listinfo/javascript
More information about the Javascript
mailing list