HTML and CSS Reference
In-Depth Information
Objective review
Answer the following questions to test your knowledge of the information in this objective.
You can find the answers to these questions and explanations of why each answer choice is
correct or incorrect in the “Answers” section at the end of this chapter.
Which of the following JavaScript methods can't be used to select an element in the
A. getElementById
B. querySelector
C. getElementByClassName
D. queryAll
Which line of JavaScript successfully retrieves only the image element with the ID
myDog from the following HTML? Choose all that apply.
<div id="main" class="mainStyle">
<p id="dogs">
This is a web page about dogs. Here is my dog picture:
<img src="dog.jpg" id="myDog" class="thumb"/>
Here is a picture of my friend's dog:
<img src="dog.jpg" id="myfriendsDog" class="thumb"/>
A. document.getElementbyId(“myDog”);
B. <p>.getChildNode(“img”);
C. document.getElementbyId(“dogs).querySelector (“thumb”);
D. document.querySelectorAll(“thumb”);
To hide an element in the DOM and still be able to add it back later, what should you
Nothing, because the DOM is always available in a static form.
Keep a reference to the removed node to be able to add it back.
Call the document.restoreNodes method.
You can't add an element back after it's removed.
Search WWH ::

Custom Search