+ 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 đą
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();