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 run a function for each text box. | $("input:text").____(function() { | each | ^ *each *$ |
Fill in the blank to run a function for each text box. | $("input:text")_____(function() { | .each | ^ *\.each *$ |
Fill in the blank to run a function for each text box. | $("input:text")__________ | .each(function() { | ^ *\.each\(function\(\) { *$ |
Code the first line to run a function for each text box. | $("input:text").each(function() { | ^ *\$\(•input:text•\)\.each\(function\(\) { *$ | |
5. Drag-and-drop: Holding down the left mouse button, drag the pieces of code onto the screen to code the first line to run a function for each textarea in the form. The id of the form is "dependents." | $("form#dependents textarea").each(function() { | ||
Select each image. | $("img").each | $`(`"`img`"`)`.`each | |
Select each list item in an unordered list whose id is "pets". | $("ul#pets li").each | ||
Select each paragraph whose class is "top". | $("p.top").each | ^ *\$\(•p\.top•\)\.each *$ | |
Select each h2 heading that's the first h2 heading of a parent. | $("h2:first-of-type").each | ^ *\$\(•h2:first-of-type•\)\.each *$ | |
Select each table that doesn't have the class "special". | $("table:not(.special)").each | ^ *\$\(•table:not\(\.special\)•\)\.each *$ | |
Select each text box in a particular form. Make up the id of the form. | $("form#contact input:text").each | ^ *\$\(•form#.+ input:text•\)\.each *$ | |
Display a series of alerts, each one showing the text of a list item. | $("li").each(function() { alert($(this).text()); }); | ^ *\$\(•li•\)\.each\(function\(\) {\n *alert\(\$\(this\)\.text\(\)\);\n}\); *$ | |
Select each list item in an unordered list whose id is "pets". | $("ul#pets li").each | ^ *\$\(•ul#pets li•\)\.each *$ | |
Select each paragraph whose class is "top". | $("p.top").each | ^ *\$\(•p\.top•\)\.each *$ | |
Select each h2 heading that's the first h2 heading of a parent. | $("h2:first-of-type").each | ^ *\$\(•h2:first-of-type•\)\.each *$ | |
Select each table that doesn't have the class "special". | $("table:not(.special)").each | ^ *\$\(•table:not\(\.special\)•\)\.each *$ | |
Select each text box in a particular form. Make up the id of the form. | $("form#contact input:text").each | ^ *\$\(•form#.+ input:text•\)\.each *$ | |
Display a series of alerts, each one showing the text of a list item. | $("li").each(function() { alert($(this).text()); }); | ^ *\$\(•li•\)\.each\(function\(\) {\n *alert\(\$\(this\)\.text\(\)\);\n}\); *$ | |
http://jsfiddle.net/ASmarterWayToLearn/or3o8pdh/ | |||
http://jsfiddle.net/ASmarterWayToLearn/t4bd1e2e/ |