quick question, i know we can change the content of a
<div id="whatEverId">hello one<div>
by using:
JavaScript
x
2
1
document.getElementById("whatEverId").innerHTML="hello two";
2
now, is there a way I can ADD stuff to the div instead of replacing it??? so i can get
<div id="whatEverId">hello one hello two<div>
(using something similar of course)
Advertisement
Answer
JavaScript
1
5
1
<div id="whatever">hello one</div>
2
<script>
3
document.getElementById("whatever").innerHTML += " hello two";
4
</script>
5