1
2
3
4
5
6
7
8
9
10
To practice on your own, or to check code you believe shouldn't have been scored as incorrect, go to CodePen.
0,1,2,3,4,5,6,7,8,9
0
0
0
0
An element has been assigned to the variable el. Fill in the blank to get the text without tags. | let textOfEl = el._______; | textContent | textContent |
The markup for a list has been assigned to the variable players. Fill in the blank to copy the list, including formatting, to the targeted element. | receivingElement._______ = players; | innerHTML | innerHTML |
Some tags and text have been assigned to the variable content. Assign that content to the element with an id of "p1". | document.querySelector("#p1").innerHTML = content; | document\.querySelector\(•#p1•\)\.innerHTML=content; | |
A paragraph has been assigned to the variable graph. Assign the tags and text inside it to the variable tagsAndText, which hasn't been declared beforehand. | let tagsAndText = graph.innerHTML; | lettagsAndText=graph\.innerHTML; | |
In a single statement get the text but not tags from the h1 heading and assign it to a variable. Make up the name of the variable. | let txt = document.querySelector("h1").textContent; | let[a-z_$][a-zA-Z0-9_$]*=document\.querySelector\(•h1•\)\.textContent; | |
An element has been assigned to a variable. A second element has been assigned to another variable. In a single statement copy the text and formatting of one element to the other. Make up the variable names. | ele1.innerHTML = ele2.innerHTML; | [a-z_$][a-zA-Z0-9_$]*\.innerHTML=[a-z_$][a-zA-Z0-9_$]*\.innerHTML; | |
The markup for an element is <p id="p1">No <em>sir</em></p>. What will the following statement display? | document.querySelector("#p2").textContent = document.querySelector("#p1").innerHTML; | No <em>sir</em> | No.em>sir<\/em> |
Assign the element with an id of "#div-3" to a variable. Then, using the variable, copy its tags and text to an element that has been assigned to a second variable. Make up the variable names. | let aDiv = document.querySelector("#div-3"); anotherDiv.innerHTML = aDiv.innerHTML; |
let([a-z_$][a-zA-Z0-9_$]*)=document\.querySelector\(•#div-3•\);[\r\n][a-z_$][a-zA-Z0-9_$]*\.innerHTML=\1\.innerHTML; | |
|
|||
|