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?
using the appendChild method
What do you pass as the arguments to the element.setAttribute() method?
The attribute name and the value
What steps do you need to take in order to insert a new element into the page?
- create the element using the createElement method
2. add the new element using the appendChild method to a parent element
What is the textContent property of an element object for?
It allows you to access the text content of an element and change the text content as well
Name two ways to set the class attribute of a DOM element.
using the className property and setAttribute method
What are two advantages of defining a function to do create something (like the work of creating a DOM tree)?
- Allows you to perform a multiple code statements quickly by calling the function