Dom Creation Flashcards
Does the document.createElement() method insert a new element into the page?
no
How do you add an element as a child to another element?
DOM appendChild()
What do you pass as the arguments to the element.setAttribute() method?
attribute and the value
What steps do you need to take in order to insert a new element into the page?
After the element is created, use the element. appendChild() or element. insertBefore() method to insert it to the document.
What is the textContent property of an element object for?
returns the text content of the specified node
Name two ways to set the class attribute of a DOM element.
setattribute class attribute
What are two advantages of defining a function to do create something (like the work of creating a DOM tree)?
code is reusable