Creation Flashcards
Does the document.createElement() method insert a new element into the page?
No, it creates a node.
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?
Name, value.
What steps do you need to take in order to insert a new element into the page?
createElement(), createTextNode(), appendChild()
What is the textContent property of an element object for?
To add or change textContent
Name two ways to set the class attribute of a DOM element.
className and setAttribute
What are two advantages of defining a function to create something (like the work of creating a DOM tree)?
You don’t have to create the same DOM Tree and easy debugging