DOM Objects Worksheet
Question 1
In order to use the document.getElementById() method to 'get a handle' on an element, what attribute must that element have?
The element must have an id attribute assigned to them to be interact with.
Question 2
When you invoke document.getElementById(), you must pass in a string parameter. What does the parameter represent?
The parameter represents the id attribute that we assigned to the element, so we can call the element assigned to that id into the command.
Question 3
What does the document.getElementById() method return?
It returns the element that has been given the id which we are trying to invoke.
Question 4
What object is at the top of the DOM? In other words, what DOM object contains all other DOM objects?
The document is the variable that holds all the other DOM object due to DOM being hierarchical data structure.
Coding Problems
You'll use the following elements to complete the coding problems:
Problem 1Problem 2
Problem 3
This is myDiv
Problem 4