DOM CREATION Flashcards
Does the document.createElement() method insert a new element into the page?
Yes
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?
set new variable to create new element, include text in seperate variable if needed, then append
What is the textContent property of an element object for?
It is the text content within the element
Name two ways to set the class attribute of a DOM element.
setAttribute, element classname
What are two advantages of defining a function to do create something (like the work of creating a DOM tree)?
function can be reused
return value can be used elsewhere