?
Solved

Is innerHTML standards compliant?

Posted on 2008-06-19
4
Medium Priority
?
209 Views
Last Modified: 2013-11-19
I read that innerHTML is "non W3C DOM" and I have no idea what that means....

http://www.javascriptkit.com/domref/elementproperties.shtml

Should I use this or is there a better method?  I want to alert the text found in a div.

My code works but I want to make sure it meets standards.
<div id="m52371426">Hello World</div>
<script type="text/javascript">
alert(document.getElementById("m52371426").innerHTML);
</script>

Open in new window

0
Comment
Question by:hankknight
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 49

Expert Comment

by:Roonaan
ID: 21824521
Even when it is non W3C DOM about every major browser supports it. Why not use it?
0
 
LVL 7

Accepted Solution

by:
Zippit earned 1200 total points
ID: 21824530
from www.w3schools.com:
http://www.w3schools.com/htmldom/dom_methods.asp

innerHTML is not a part of the W3C DOM specification. However, it is supported by all major browsers.
0
 
LVL 16

Author Comment

by:hankknight
ID: 21824581
Is there a W3C approved alternative?
0
 
LVL 49

Assisted Solution

by:Roonaan
Roonaan earned 800 total points
ID: 21824652
Probableto manually parse all childnodes...
0

Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
This article discusses how to implement server side field validation and display customized error messages to the client.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question