+ 2

I have two exactly the same web documents, but they don't output the same. What is my problem?

I worked on a countdown, and wanted to use "innerHtml". But it didn't worked and so I looked to other web codes using "innerHtml" and copied one. I deleted all I didn't need, and it worked! https://code.sololearn.com/Wp59zfu34HsY/?ref=app https://code.sololearn.com/W6FU9GYWmMtn/?ref=app Please comment if both output "b" on your smartphone etc. or not and if you know such problems, please comment it too.

11th Jan 2018, 8:52 PM
Niklas
Niklas - avatar
3 Answers
+ 8
Your problem is innerHTML , but not innerHtml. right variant: window.onload = function() { var x = document.getElementById("p"); x.innerHTML= "b"; } false variant: window.onload = function() { var x = document.getElementById("p"); x.innerHtml= "b"; }
11th Jan 2018, 8:58 PM
Vitaliy Angelov (Rostov-on-Don)
Vitaliy Angelov (Rostov-on-Don) - avatar
+ 2
in the second one you use x.innerHtml instead of x.innerHTML thats why the content doesn't change
11th Jan 2018, 9:40 PM
᠌᠌Code X
᠌᠌Code X - avatar
+ 1
I'm confused
11th Jan 2018, 9:37 PM
᠌᠌Code X
᠌᠌Code X - avatar