dom-manipulation Flashcards

1
Q

What is the className property of element objects?

A

it gives you the class name of that element

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How do you update the CSS class attribute of an element using JavaScript?

A

.className

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the textContent property of element objects?

A

its a property that stores any text present as content in an element

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How do you update the text within an element using JavaScript?

A

var.textContent = newTextContent

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Is the event parameter of an event listener callback always useful?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Would this assignment be simpler or more complicated if we didn’t use a variable to keep track of the number of clicks?

A

it would be more complicated because you would need to search the dom for clicks if you chose not to use a variable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Why is storing information about a program in variables better than only storing it in the DOM?

A

so that you can keep all your data in javascript instead of having to search the dom all the time.
security and functionality concerns

How well did you know this?
1
Not at all
2
3
4
5
Perfectly