Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
37
rated 0 times [  43] [ 6]  / answers: 1 / hits: 25230  / 11 Years ago, wed, february 27, 2013, 12:00:00

Why doesn't innerHtml work?



<script src=jquery.js></script>
<script type=text/javascript>
function chat()
{
alert (started!);
document.getElementById(test).innerHtml=foo;
}
</script>
<body id=body onload=chat();>
<p id=test>
test..
</p>
</body>


started! is showing, but the content of <p> doesn't get changed to foo as intended. Why?


More From » html

 Answers
67

Casing matters, it's innerHTML not innerHtml. Try this:



document.getElementById(test).innerHTML=foo;

[#79955] Tuesday, February 26, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
dequant

Total Points: 88
Total Questions: 99
Total Answers: 95

Location: Ukraine
Member since Sun, Dec 13, 2020
4 Years ago
dequant questions
;