DOM Creation Flashcards
Does the document.createElement() method insert a new element into the page?
no not to the page but it does create a new element
How do you add an element as a child to another element?
.appendChild()
What do you pass as the arguments to the element.setAttribute() method?
we pass what attribute we want to set and the value we want from it
What steps do you need to take in order to insert a new element into the page?
first we create the element, then we add content, then set attribute and lastly we add it to the dom with the append child method
What is the textContent property of an element object for?
used to give a node element some text content
Name two ways to set the class attribute of a DOM element.
.className = , .setAttribute()
What are two advantages of defining a function to do create something (like the work of creating a DOM tree)?
You can create applications that update the data of the page without needing a refresh
You can drag, move, and delete elements.