[Javascript] .appendParent

Terry Riegel riegel at clearimageonline.com
Tue Nov 18 12:18:38 CST 2008


David,

I am trying your code in Safari and it looks like the  
createElementById is not part of its language.

TypeError: Value undefined (result of expression  
document.createElementById) is not object.

Do you know of an alternative for createElementById?

Thanks for any help,

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