⬅︎ Back to firstChild.nodeValue vs. innerHTML
check this:<html><head><script type="text/javascript">function initial(){ document.getElementById("msg").innerHTML = "<div style='margin: 10px; padding: 20px;'><i>Text</i></div>"; document.getElementById("msg1").firstChild.nodeValue = "<div style='margin: 10px; padding: 20px;'><i>Text</i></div>";}</script></head><body onload="initial()"><div id="msg">empty</div><div id="msg1">empty1</div><br><br><br><br><a target="firefox" href="http://validator.w3.org/check?uri=referer">checkme with validator...!</a></body></html>
Comment
check this:
<html>
<head>
<script type="text/javascript">
function initial(){
document.getElementById("msg").innerHTML = "<div style='margin: 10px; padding: 20px;'><i>Text</i></div>";
document.getElementById("msg1").firstChild.nodeValue = "<div style='margin: 10px; padding: 20px;'><i>Text</i></div>";
}
</script>
</head>
<body onload="initial()">
<div id="msg">empty</div>
<div id="msg1">empty1</div>
<br><br><br><br>
<a target="firefox" href="http://validator.w3.org/check?uri=referer">checkme with validator...!</a>
</body>
</html>