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

Creating Elements

// Creating a <p> element
const p = document.createElement("p");
// Adding content to the element
p.innerHTML = "The new paragraph.";

The element and its content are now created, but they only exist in the memory of the JavaScript engine. To integrate them into the page, we can retrieve the body or any other element of the existing page and append the new element as its last e...