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 if it's absent and remove the class if it's present. | pgraph.classList________("hidden"); | .toggle | \.toggle |
Fill in the blank to check whether the element has the class "main". | pgraph.___________________________; | classList.contains("main"); | classList\.contains\(•main•\); |
Fill in the blank to replace the class "special" with the class "normal". | pgraph.____________________________; | classList.replace("special", "normal"); | classList\.replace\(•special•,•normal•\); |
An element has been assigned to the variable elem. Add a class. Make up the class name. | elem.classList.toggle("hidden"); | elem\.classList\.toggle\(•.*•\); | |
An element has been assigned to the variable elem. If it has a particular class, display "Yes" in an alert. Make up the name of the class. | if (elem.classList.contains("special")) { alert("Yes"); } |
if\(elem\.classList\.contains\(•.*•\)\){[\r\n]alert\(•Yes•\);[\r\n]} | |
An element has been assigned to the variable elem. Replace one class with another. Make up the names of the classes. | elem.classList.replace("normal", "special"); | elem\.classList\.replace\(•.*•,•.*•\); | |
An alternative to classList is ______. | className | className | |
An element has been assigned to the variable pgraph. Replace all of its classes with another class. Make up the name of the class. Hint: Don't try to do this with classList. | pgraph.className = "main"; | pgraph\.className=•.*•; | |
|
|||
|