Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DOM Level 2 and innerHTML

Status
Not open for further replies.

WindUp

Programmer
Mar 6, 2003
100
0
0
US
I read at that "innerHTML" has been depreciated and should not be used any more (if I want to stay compliant with DOM Level 2.) So that begs the question - What do I use for cross-browser compatibility? How do I add a child HTML element to an existing HTML element?


Good Luck! [thumbsup2]
WindUp
 
Where you can element.deleteContent() then replace the content with element.appendChild() but really I wouldnt' worry about innerHTML leaving anytime soon. It's there to stay IMO.

Also before Mozilla had innerHTML you could add it manually by setting up setters and getters to HTMLElement.prototype.innerHTML.

There is a tutorial here :


You may be capable of just adding a few upgrades to your browser implementation if you want to retain the usage of innerHTML in your code and some browser deprecates innerHTML.

Gary Haran
********************************
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top