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
Fill in the blank to assign the paragraph to the variable para. | var ____ = $("p#p3"); | para | ^ *para *$ |
Fill in the blank to assign the paragraph to the variable para. | ___ para = $("p#p3"); | var | ^ *var *$ |
Fill in the blank to assign the paragraph to the variable para. | _________ $("p#p3"); | var para = | ^ *var para *= *$ |
Assign all h2 headings to the variable head. | var head = $("h2"); | ^ *var head *= *\$\(•h2•\); *$ | |
5. Drag-and-drop: Holding down the left mouse button, drag the pieces of code onto the screen to assign an image whose id is "cat" to a variable, pic. | var pic = $("img#cat"); | ||
Assign all divs whose class is "secondary" to the variable d2. | var d2 = $("div.secondary"); | var`1spaced2`1space=`1space$`(`"`div`.`secondary`"`)`; | |
Assign an ordered list whose id is "products" to the variable prod. | var prod = $("ol#products"); | ||
Assign a particular paragraph to the variable p1. Make up the paragraph's id. | var p1 = $("p#main"); | ^ *var p1 *= *\$\(•p#.+•\); *$ | |
Assign a particular paragraph to the variable p1. Make up the paragraph's id. Using the variable as the selector, replace the paragraph's id. Make up the new id. | var p1 = $("p#main"); p1.attr("id", "secondary"); | ^ *var p1 = \$\(•p#.+•\);\np1\.attr\(•id•, •.+•\); *$ | |
Assign a particular image to the variable pic. Make up the id. Slide it into view, using the variable as the selector. | var pic = $("img#loris"); pic.slideDown(); | ^ *var pic *= *\$\(•img#(.+)•\);\n *pic\.slideDown\(\); *$ | |
Assign a particular image to the variable pic. Make up the id. Assign the number 3000 to the variable speed. Slide the image out of view, using the first variable as the selector and the second variable as the speed. | var pic = $("img#loris"); var speed = 3000; pic.slideUp(speed); | ^ *var pic *= *\$\(•img#.+•\);\n *var speed *= *3000;\n *pic\.slideUp\(speed\); *$ | |
Assign all paragraphs that contain "free" to the variable gonzo. Using the variable as a selector, hide these paragraphs. | var gonzo = $("p:contains('free')"); gonzo.hide(); | ^ *var gonzo *= *\$\(•p:contains\(◘free◘\)•\);\n *gonzo\.hide\(\); *$ | |
Assign an ordered list whose id is "products" to the variable prod. | var prod = $("ol#products"); | ^ *var prod *= *\$\(•ol#products•\); *$ | |
Assign a particular paragraph to the variable p1. Make up the paragraph's id. | var p1 = $("p#main"); | ^ *var p1 *= *\$\(•p#.+•\); *$ | |
Assign a particular paragraph to the variable p1. Make up the paragraph's id. Using the variable as the selector, replace the paragraph's id. Make up the new id. | var p1 = $("p#main"); p1.attr("id", "secondary"); | ^ *var p1 = \$\(•p#.+•\);\np1\.attr\(•id•, •.+•\); *$ | |
Assign a particular image to the variable pic. Make up the id. Slide it into view, using the variable as the selector. | var pic = $("img#loris"); pic.slideDown(); | ^ *var pic *= *\$\(•img#(.+)•\);\n *pic\.slideDown\(\); *$ | |
Assign a particular image to the variable pic. Make up the id. Assign the number 3000 to the variable speed. Slide the image out of view, using the first variable as the selector and the second variable as the speed. | var pic = $("img#loris"); var speed = 3000; pic.slideUp(speed); | ^ *var pic *= *\$\(•img#.+•\);\n *var speed *= *3000;\n *pic\.slideUp\(speed\); *$ | |
Assign all paragraphs that contain "free" to the variable gonzo. Using the variable as a selector, hide these paragraphs. | var gonzo = $("p:contains('free')"); gonzo.hide(); | ^ *var gonzo *= *\$\(•p:contains\(◘free◘\)•\);\n *gonzo\.hide\(\); *$ | |
http://jsfiddle.net/ASmarterWayToLearn/onm5w66t/ | |||
http://jsfiddle.net/ASmarterWayToLearn/d635at1p/ |