dom-manipulation Flashcards
What is the className property of element objects?
It 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 selector, dot, className, equals, the desired class(es) in quotes
What is the textContent property of element objects?
It represents the text content of the node and its descendants
How do you update the text within an element using JavaScript?
Node selector, dot, textContent, equals, the desired text
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?
It’s faster and we can reuse it whenever it is needed