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 select the first div. | $("div:_____") | first | ^ *first *$ |
Fill in the blank to select the last list item. | $("ul _________") | li:last | ^ *li:last *$ |
Select the first paragraph. | $("p:first") | ^ *\$\(•p:first•\) *$ | |
Select the last paragraph of a div whose id is "main". | $("div#main p:last") | ^ *\$\(•div#main p:last•\) *$ | |
5. Drag-and-drop: Holding down the left mouse button, drag the pieces of code onto the screen to assign a class to the first div. | $("div:first").attr("class", "prominent"); | ||
Select the first h2 heading. | $("h2:first") | $`(`"`h2`:`first`"`) | |
Select the last image whose class is "face". | $("img.face:last") | ||
Select the first row of the table whose id is "pets". | $("table#pets li:first") | ^ *\$\(•table#pets li:first•\) *$ | |
Select the last paragraph of a particular div. Make up the div's id. | $("div#main p:last") | ^ *\$\(•div#.+ p:last•\) *$ | |
Select the first or last instance (your choice) of a link tag. | $("a:first") | ^ *\$\(•a:(first|last)•\) *$ | |
Add a class to a first or last (your choice) div, paragraph, or list. Choose the element and the class name. | $("ol:first").addClass("important"); | ^ *\$\(•(div|p|ul|ol):(first|last)•\)\.addClass\(•.+•\); *$ | |
Select the first paragraph of one div and the last paragraph of another div. Make up the ids of the divs. | $("div#main p:first, div#final p:last") | ^ *\$\(•div#.+ p:first, div#.+ p:last•\) *$ | |
Select the last image whose class is "face". | $("img.face:last") | ^ *\$\(•img\.face:last•\) *$ | |
Select the first row of the table whose id is "pets". | $("table#pets li:first") | ^ *\$\(•table#pets li:first•\) *$ | |
Select the last paragraph of a particular div. Make up the div's id. | $("div#main p:last") | ^ *\$\(•div#.+ p:last•\) *$ | |
Select the first or last instance (your choice) of a link tag. | $("a:first") | ^ *\$\(•a:(first|last)•\) *$ | |
Add a class to a first or last (your choice) div, paragraph, or list. Choose the element and the class name. | $("ol:first").addClass("important"); | ^ *\$\(•(div|p|ul|ol):(first|last)•\)\.addClass\(•.+•\); *$ | |
Select the first paragraph of one div and the last paragraph of another div. Make up the ids of the divs. | $("div#main p:first, div#final p:last") | ^ *\$\(•div#.+ p:first, div#.+ p:last•\) *$ | |
http://jsfiddle.net/ASmarterWayToLearn/p45t6ore/ | |||
http://jsfiddle.net/ASmarterWayToLearn/n0e2njbt/ |