dom-manipulation Flashcards
What is the className property of element objects?
The className property of the Element interface gets and sets the value of the class attribute of the specified element.
How do you update the CSS class attribute of an element using JavaScript?
element.className = ‘ new class name ‘
What is the textContent property of element objects?
it either returns the text from the element or sets it
How do you update the text within an element using JavaScript?
element.textContent = ‘ text to add ‘
Is the event parameter of an event listener callback always useful?
no
Would this assignment be simpler or more complicated if we didn’t use a variable to keep track of the number of clicks?
more complicated
Why is storing information about a program in variables better than only storing it in the DOM?
because you can name the variable to be descriptive making it easier to read the code