dom-manipulation Flashcards
What is the className property of element objects?
it gives you the class name of that element
How do you update the CSS class attribute of an element using JavaScript?
.className
What is the textContent property of element objects?
its a property that stores any text present as content in an element
How do you update the text within an element using JavaScript?
var.textContent = newTextContent
Is the event parameter of an event listener callback always useful?
the vast majority of the time; yes
but every once in a while you will need to be very very precise and only need it for one variable
Would this assignment be simpler or more complicated if we didn’t use a variable to keep track of the number of clicks?
it would be more complicated because you would need to search the dom for clicks if you chose not to use a variable
Why is storing information about a program in variables better than only storing it in the DOM?
so that you can keep all your data in javascript instead of having to search the dom all the time.
security and functionality concerns