dom-manipulation Flashcards
What is the className property of element objects?
The name of the class attribute it is being assigned.
How do you update the CSS class attribute of an element using JavaScript?
element.className = ‘name of class’;
What is the textContent property of element objects?
The text or words the HTML or DOM element displays.
How do you update the text within an element using JavaScript?
element.textContent = ‘new string’;
Is the event parameter of an event listener callback always useful?
Mostly, yes. It returns all properties and values pertaining to the event.
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?
Easier for reusability.