200919 TIL DOM document.getElementById();

journey·2020년 9월 18일
0
<h2>JavaScript can Change HTML</h2>

<p id="p1">Hello World!</p>

<script>
document.getElementById("p1").innerHTML = "New!";
</script>

<p id="p1">The paragraph above was changed by a script.</p>
<h2>JavaScript can Change HTML</h2>

<p>Hello World!</p>

<script>
document.getElementById("p1").innerHTML = "New!";
</script>

<p id="p1">The paragraph above was changed by a script.</p>
<h2 id="p1">JavaScript can Change HTML</h2>

<p id="p1">Hello World!</p>

<script>
document.getElementById("p1").innerHTML = "New!";
</script>

<p>The paragraph above was changed by a script.</p>
profile
J for Journey

0개의 댓글