Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
74
rated 0 times [  80] [ 6]  / answers: 1 / hits: 42649  / 12 Years ago, sat, april 14, 2012, 12:00:00

I really cannot understand why this does not work. I've tried couple of tricks but I just don't get it.



<html>
<head>
<script type=text/javascript>
alert('Hey');
var vText = document.getElementById(results);
vText.innerHTML = 'Changed';
alert(vText.innerHTML);
</script>
</head>
<body>
<div id=results>
hey there
</div>
</body>
</html>

More From » html

 Answers
0

This is working as you can see here:



http://jsfiddle.net/gHbss/



It's important that you put the JavaScript after your HTML div container.


[#86238] Friday, April 13, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
shamya

Total Points: 38
Total Questions: 101
Total Answers: 96

Location: Thailand
Member since Thu, Apr 22, 2021
3 Years ago
;