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 all parents of all h2 headings. | $("h2")._______() | parent | ^ *parent *$ |
Fill in the blank to select all parents of all h2 headings. | $("h2")__________ | .parent() | ^ *\.parent\(\) *$ |
Select all parents of all h2 headings. | $("h2").parent() | ^ *\$\(•h2•\)\.parent\(\) *$ | |
Select all parents of all images whose class is "people". | $("img.people").parent() | ^ *\$\(•img\.people•\)\.parent\(\) *$ | |
5. Drag-and-drop: Holding down the left mouse button, drag the pieces of code onto the screen to color the text contents of all parents of h2 headings black. | $("h2").parent().css("color", "black"); | ||
Select all parents of all list items. | $("li").parent() | $`(`"`li`"`)`.`parent`(`) | |
Select all parents of all paragraphs whose class is "info". | $("p.info").parent() | ||
Add a class to all parents of all images. Make up the class name. | $("img").parent().addClass("bright"); | ^ *\$\(•img•\)\.parent\(\)\.addClass\(•.+•\); *$ | |
Changing opacity, make all parents of all paragraphs of a certain class disappear. Make up the class name. | $("p.offensive").parent().css({opacity: "0"}); | ^ *\$\(•p\..+•\)\.parent\(\)\.css\({opacity: •0•}\); *$ | |
Select all parents of all paragraphs and images. | $("p, img").parent() | ^ *\$\(•p, img•\)\.parent\(\) *$ | |
Remove all parents of all paragraphs of a certain class. Make up the class name. | $("p.offensive").parent().remove(); | ^ *\$\(•p\..+•\)\.parent\(\)\.remove\(\); *$ | |
Select all the parents of all inputs. Give them a yellow background-color. | $("input").parent().css("background-color", "yellow"); | ^ *\$\(•input•\)\.parent\(\)\.css\(•background-color•, •yellow•\); *$ | |
Select all parents of all paragraphs whose class is "info". | $("p.info").parent() | ^ *\$\(•p\.info•\)\.parent\(\) *$ | |
Add a class to all parents of all images. Make up the class name. | $("img").parent().addClass("bright"); | ^ *\$\(•img•\)\.parent\(\)\.addClass\(•.+•\); *$ | |
Changing opacity, make all parents of all paragraphs of a certain class disappear. Make up the class name. | $("p.offensive").parent().css({opacity: "0"}); | ^ *\$\(•p\..+•\)\.parent\(\)\.css\({opacity: •0•}\); *$ | |
Select all parents of all paragraphs and images. | $("p, img").parent() | ^ *\$\(•p, img•\)\.parent\(\) *$ | |
Remove all parents of all paragraphs of a certain class. Make up the class name. | $("p.offensive").parent().remove(); | ^ *\$\(•p\..+•\)\.parent\(\)\.remove\(\); *$ | |
Select all the parents of all inputs. Give them a yellow background-color. | $("input").parent().css("background-color", "yellow"); | ^ *\$\(•input•\)\.parent\(\)\.css\(•background-color•, •yellow•\); *$ | |
http://jsfiddle.net/ASmarterWayToLearn/kpeubv0x/ | |||
http://jsfiddle.net/ASmarterWayToLearn/ekpq7uto/ |