Editing the DOM
Creating elements
let newElement = document.addElement("a");Setting attributes
newElement.className = "purple-link";
newElement.href = "https://orbital.comp.nus.edu.sg/";newElement.setAttribute("className", "purple-link");
newElement.setAttribute("href", "https://orbital.comp.nus.edu.sg/");Adding text
Adding elements to the page
Insert before
Insert at the end
Removing elements from the page
Replace one element with another
Next steps
Last updated