dom manipulation Flashcards
What is the className property of element objects?
It is a string that represents all the classes the element has
How do you update the CSS class attribute of an element using JavaScript?
using myElement.className and reassigning it
What is the textContent property of element objects?
It is a string that represents the text content of an element
How do you update the text within an element using JavaScript?
using myElement.textContent and reassigning it
Is the event parameter of an event listener callback always useful?
Only when you want to access the properties of that object
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 because then you would have to manually change the strings
Why is storing information about a program in variables better than only storing it in the DOM?
It allows it to be more flexible