DOM Flashcards

1
Q

What does DOM stand for?

A

Document Object Model

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

What is the DOM?

A

A DOM is a treelike structure that represents the HTML elements on a webpage

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

Give a DOM example for changing a text value on an HTML window

A

document.getElementById(“test”).innerHTML = “now it is different”;

document is the root and contains all elements

getElementById followed by the element I am interested in.

innerHTML is the property which I am setting

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

List 2 common selector methods used by JS for DOM elements

A

document.querySelector(“#test”)
//this will find the id test

document.querySelectorAll(“test”)
//this will find all elements with id test

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

What things can be manipulated using DOM?

A

element properties like
value
innerHTML = “my name”;
CSS
styl.cssText = “fontWeight : bold”;
create a new element
createElement (“this”)
remove an element
remove()

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