Dom-Creation Flashcards

1
Q

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

A

Yes

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

using the appendChild method

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

The attribute name and the value

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
  1. create the element using the createElement method

2. add the new element using the appendChild method to a parent element

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

It allows you to access the text content of an element and change the text content as well

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

using the className property and setAttribute method

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
  1. Allows you to perform a multiple code statements quickly by calling the function
How well did you know this?
1
Not at all
2
3
4
5
Perfectly