</> Code Corner

HTML · HTML Tutorial · Lesson 26

HTML JavaScript

Make pages dynamic with <script>.

JavaScript makes HTML pages more dynamic and interactive. The <script> element contains scripts or points to an external file with src.

Example

<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = "Hello JavaScript!";
</script>

What JavaScript can do

Example

<p id="demo">JavaScript can change content.</p>
<button type="button" onclick="document.getElementById('demo').style.color = 'red'">Make it red</button>

Keep reading “HTML JavaScript”

Sign up to read the full lesson (2 more parts), try every example in the live editor, and take the 5-question quiz.

Chat with us 👋