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 the elements that share the same parent as a list item. | $("ul.choices li")._______() | siblings | ^ *siblings *$ |
Fill in the blank to select all the elements that share the same parent as a list item. | $("ul.choices li").________ | siblings() | ^ *siblings\(\) *$ |
Fill in the blank to select all the elements that share the same parent as the list item. | $("ul.choices li")________ | .siblings() | ^ *\.siblings\(\) *$ |
Select all the elements that share the same parent as a list item in an unordered list whose class is "choices". | $("ul.choices li").siblings() | ^ *\$\(•ul\.choices li•\)\.siblings\(\) *$ | |
5. Drag-and-drop: Holding down the left mouse button, drag the pieces of code onto the screen to color all siblings of $(this) #999. | $(this).siblings().css("color", "#999"); | ||
Select all the siblings of $(this). | $(this).siblings() | $`(`this`)`.`siblings`(`) | |
Select all siblings of all images. | $("img").siblings() | ||
Select all siblings of a particular paragraph. Make up the id of the paragraph. | $("p#graph_1").siblings() | ^ *\$\(•p#.+•\)\.siblings\(\) *$ | |
Remove a class from all siblings of a class of divs. Make up both class names. | $("div.main").siblings().removeClass("visible"); | ^ *\$\(•div\..+•\)\.siblings\(\)\.removeClass\(•.+•\); *$ | |
When any list item is clicked, slide its siblings out of sight. Don't specify a speed for the slide. | $("li").on("click", function() { $(this).siblings().slideUp(); }); | ^ *\$\(•li•\)\.on\(•click•, function\(\) {\n *\$\(this\)\.siblings\(\)\.slideUp\(\);\n}\); *$ | |
When the user mouses over any image, reduce the opacity of its siblings to 50%. | $("img").on("mouseover", function() { $(this).siblings().css({"opacity": ".5"}); }); | ^ *\$\(•img•\)\.on\(•mouseover•, function\(\) {\n *\$\(this\)\.siblings\(\)\.css\({•opacity•: •\.5•}\);\n *}\); *$ | |
Select all siblings of the paragraph that's the second child of a div whose id is "target". Color the siblings black. | $("div#target p:nth-child(2)").siblings().css("color", "black"); | ^ *\$\(•div#target p:nth-child\(2\)•\)\.siblings\(\)\.css\(•color•, •black•\); *$ | |
Select all siblings of all images. | $("img").siblings() | ^ *\$\(•img•\)\.siblings\(\) *$ | |
Select all siblings of a particular paragraph. Make up the id of the paragraph. | $("p#graph_1").siblings() | ^ *\$\(•p#.+•\)\.siblings\(\) *$ | |
Remove a class from all siblings of a class of divs. Make up both class names. | $("div.main").siblings().removeClass("visible"); | ^ *\$\(•div\..+•\)\.siblings\(\)\.removeClass\(•.+•\); *$ | |
When any list item is clicked, slide its siblings out of sight. Don't specify a speed for the slide. | $("li").on("click", function() { $(this).siblings().slideUp(); }); | ^ *\$\(•li•\)\.on\(•click•, function\(\) {\n *\$\(this\)\.siblings\(\)\.slideUp\(\);\n}\); *$ | |
When the user mouses over any image, reduce the opacity of its siblings to 50%. | $("img").on("mouseover", function() { $(this).siblings().css({"opacity": ".5"}); }); | ^ *\$\(•img•\)\.on\(•mouseover•, function\(\) {\n *\$\(this\)\.siblings\(\)\.css\({•opacity•: •\.5•}\);\n *}\); *$ | |
Select all siblings of the paragraph that's the second child of a div whose id is "target". Color the siblings black. | $("div#target p:nth-child(2)").siblings().css("color", "black"); | ^ *\$\(•div#target p:nth-child\(2\)•\)\.siblings\(\)\.css\(•color•, •black•\); *$ | |
http://jsfiddle.net/ASmarterWayToLearn/qgvxcvvy/ | |||
http://jsfiddle.net/ASmarterWayToLearn/mh6zcn3m/ |