+ 2
Why the output is coder?
<div id ="test"></div> <script> var a =document.getElementById("test"); a.innerHTML="hello"; a.innerHTML="CODER!"; </script>
7 Answers
+ 4
if you want the output is helloCODER!, concat the both a variable
<div id ="test"></div>
<script>
var a =document.getElementById("test");
a.innerHTML="hello";
a.innerHTML+="CODER!";
</script>
+ 3
CODER was overwrite hello
+ 3
a.innerHTML = "CODER!" is overwriting previous value of a.innerHTML
+ 2
u want output hello CODER u need use "+="
+ 2
thanx all ...what sololearn is today is all about you !!