The next several exercises are timed. If you type slowly or dislike time pressure, feel free to increase the allotted time.
Name and email required. Check any number of boxes.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19
0
0
0
Type the character that's missing from this code. | $("p ul.main").addClass("big"); | , | ^ *, *$ |
Fill in the blank to select all paragraphs and also select all elements whose class is "special" | ____________.css("font-size", "1.3em"); | $("p, .special") | ^ *\$\(•p, \.special•\) *$ |
Fill in the blank to select h2 headings, a paragraph whose ID is "special", and a paragraph whose ID is "key". | ______________.css("color", "red"); | $("h2, p#special, p#key") | ^ *\$\(•h2, p#special, p#key•\) *$ |
Fill in the blank to select spans whose class is "prom" and an h3 heading whose ID is "special". | ______________.css("color", "red"); | $("span.prom, h3#special") | ^ *\$\(•span.prom, h3#special•\) *$ |
5. Drag-and-drop: Holding down the left mouse button, drag the pieces of code onto the screen to select all divs whose class is "important" and all paragraphs whose class is "important". | $("div.important, p.important") | ||
Select an image with with the ID "i3" and an image with the ID "i5". | $("img#i3, img#i5") | $`(`"`img`#`i3`comma1space`img`#`i5`"`) | |
Add the class "big" to all unordered lists and all ordered lists. | $("ul, ol").addClass("big"); | ||
Toggle images whose class is "group1" and images whose class is "group2". | $("img.group1, img.group2").toggle(); | ^ *\$\(•img\.group1, img\.group2•\)\.toggle\(\); *$ | |
Select divs and paragraphs of the same class. Make up the class name. | $("div.main, p.main") | ^ *\$\(•div\.(.+), p\.\1•\) *$ | |
Select a div and a paragraph. Make up IDs for them. | $("div#special, p#unique") | ^ *\$\(•div#.+, p#.+•\) *$ | |
When either of two paragraphs is clicked, all images slide into view. Make up the two IDs. | $("p#first, p#second").on("click", function() { $("img").slideDown(); }); | ^ *\$\(•p#.+, p#.+•\)\.on\(•click•, function\(\) {\n *\$\(•img•\)\.slideDown\(\);\n *}\); *$ | |
When either of two paragraphs is clicked, the one that's been clicked is hidden. Make up the two IDs. Use hide()and this. | $("p#first, p#second").on("click", function() { $(this).hide(); }); | ^ *\$\(•p#.+, p#.+•\)\.on\(•click•, function\(\) {\n *\$\(this\)\.hide\(\);\n *}\); *$ | |
Add the class "big" to all unordered lists and all ordered lists. | $("ul, ol").addClass("big"); | ^ *\$\(•ul, ol•\)\.\addClass\(•big•\); *$ | |
Toggle images whose class is "group1" and images whose class is "group2". | $("img.group1, img.group2").toggle(); | ^ *\$\(•img\.group1, img\.group2•\)\.toggle\(\); *$ | |
Select divs and paragraphs of the same class. Make up the class name. | $("div.main, p.main") | ^ *\$\(•div\.(.+), p\.\1•\) *$ | |
Select a div and a paragraph. Make up IDs for them. | $("div#special, p#unique") | ^ *\$\(•div#.+, p#.+•\) *$ | |
When either of two paragraphs is clicked, all images slide into view. Make up the two IDs. | $("p#first, p#second").on("click", function() { $("img").slideDown(); }); | ^ *\$\(•p#.+, p#.+•\)\.on\(•click•, function\(\) {\n *\$\(•img•\)\.slideDown\(\);\n *}\); *$ | |
When either of two paragraphs is clicked, the one that's been clicked is hidden. Make up the two IDs. Use hide()and this. | $("p#first, p#second").on("click", function() { $(this).hide(); }); | ^ *\$\(•p#.+, p#.+•\)\.on\(•click•, function\(\) {\n *\$\(this\)\.hide\(\);\n *}\); *$ | |
http://jsfiddle.net/ASmarterWayToLearn/mdmmj6qf/ | |||
http://jsfiddle.net/ASmarterWayToLearn/v9eLesw8/ |