Bummer! This is just a preview. You need to be signed in with an account to view the entire instruction.

Well done!

You have completed (UPI) Chapter 9: Understanding the Document Object Model (DOM) with JavaScript!

Instruction

Accessing Nodes

Accessing Nodes

You can access nodes of the DOM tree by various methods. One of them is getElementById.

<!DOCTYPE html>
<html>
 <head>
   <script>
     function go() {
       "use strict";
       const p = document.getElementById("p2");
       alert(p.innerHTML);
     }
   </script>
 </head>
 <body id="body">
   <p id="p1" style="background: aqua">one</p>
   <p i...