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
Fill in the blank to add the class "pretty" to the element. | document.querySelector("p")_____________________; | .classList.add("pretty") | \.classList\.add\(•pretty•\) |
Fill in the blank to remove the class "pretty" from the element. | document.querySelector("p")_____________________; | .classList.remove("pretty") | \.classList\.remove\(•pretty•\) |
An element has been assigned to the variable targetedDiv. Assign its class list to the variable cList. | let cList = targetedDiv.classList; | letcList=targetedDiv\.classList; | |
An element has been assigned to the variable targetedDiv. Add a class. Make up the class name. | targetedDiv.classList.add("narrow"); | targetedDiv\.classList\.add\(•.*•\); | |
Add a class to an h1 heading. Make up the class name. | document.querySelector("h1").classList.add("emphasized"); | document\.querySelector\(•h1•\)\.classList\.add\(•.*•\); | |
An element has been assigned to a variable. Remove two classes from it. Make up the variable name and the class names. | elem.classList.remove("big", "bold"); | [a-z_$][a-zA-Z0-9_$]*\.classList\.remove\(•.*•,•.*•\); | |
Code the first line of an if statement that checks whether the first unordered list in the document has a particular class. Make up the class name. | if (document.querySelector("ul").hasClass("indented") { | if\(document\.querySelector\(•ul•\)\.hasClass\(•.*•\){ | |
An element has been assigned to the variable contentDiv. Add three classes to it. Make up the class names. | contentDiv.classList.add("normal", "prominent", "wide"); | contentDiv\.classList\.add\(•.*•,•.*•,•.*•\); | |
|
|||
|