dom-creation Flashcards

1
Q

Does the document.createElement() method insert a new element into the page?

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

How do you add an element as a child to another element?

A

parent.appendChild(child)

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

What do you pass as the arguments to the element.setAttribute() method?

A

any value but it gets converted to a string. dom is made to work with multiple languages so it needs an easy. way to crossover

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

What steps do you need to take in order to insert a new element into the page?

A

query selector an element and assign to variable
variable.appendChild(newElement)

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

What is the textContent property of an element object for?

A

to retrieve current text to view it or change it

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

Name two ways to set the class attribute of a DOM element.

A

object.setAttribute(‘attribute’, value)
object.className = ‘value’

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

What are two advantages of defining a function to do create something (like the work of creating a DOM tree)?

A

the function can be reused
and you can use the output in different locations for different jobs

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

What are two advantages of defining a function to do create something (like the work of creating a DOM tree)?

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