+ 1

HELP WITH JAVASCRIPT

im on my javascript course and when i test this: https://code.sololearn.com/WGYMwgBO47Fe/?ref=app the error i get is cannot set 'inner.HTML` of null please help me 😱

16th Apr 2018, 1:03 PM
Ceci Alejo
Ceci Alejo - avatar
1 Answer
+ 5
1. Copy the JS into the body tag. <body> <div id="divId">before</div> <script> var tryme = document.getElementById("divId") tryme.innerHTML = "hello world!"; </script> </body> 2. or you can use function a(){ var x=document.getElementById("divId"); x.innerHTML=" HELLO"; window.onload=a();
16th Apr 2018, 1:24 PM
Muhd Khairul Amirin
Muhd Khairul Amirin - avatar