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
To change a link, what attribute do you specify? | href | ^ *href *$ | |
Assume the link is to another website. In the following code, what are the next five characters? | $(this).attr("href", " | http: | ^ *http: *$ |
Fill in the blank to change the link to loris.com. | $(this).______________ | attr("href", "http://www.loris.com"); | ^ *attr\(•href•, •http:\/\/www\.loris\.com•\); *$ |
Fill in the blank to change a link whose id is "link_1". | ________.attr("href", "http://www.loris.com"); | $("a#link_1") | ^ *\$\(•a#link_1•\) *$ |
5. Drag-and-drop: Holding down the left mouse button, drag the pieces of code onto the screen to change the textarea's size to 8 rows and 100 columns. | $("textarea.expandable").attr("rows", "8").attr("cols", "100"); | ||
Change all links to loris.com. | $("a").attr("href", "http://www.loris.com"); | $`(`"`a`"`)`.attr`(`"`href`"`comma`1space"`http`:`/`/`www`.`loris`.`com`"`)`; | |
Change the link whose id is "info" to loris.com. | $("a#info").attr("href", "http://www.loris.com"); | ||
Assume you're changing the link to another page on the same site. The link's id is "info". The page is about.html. | $("a#info").attr("href", "about.html"); | ^ *\$\(•a#info•\)\.attr\(•href•, •about\.html•\); *$ | |
Change the link whose id is "info" to about.html at loris.com. | $("a#info").attr("href", "http://www.loris.com/about.html"); | ^ *\$\(•a#info•\)\.attr\(•href•, •http:\/\/www\.loris\.com\/about\.html•\); *$ | |
Change the width and height of all textareas. Make up the numbers. | $("textarea").attr("rows", "8").attr("cols", "100"); | ^ *\$\(•textarea•\)\.attr\(•rows•, •[0-9]+•\)\.attr\(•cols•, •[0-9]+•\); *$ | |
Change the width and height of textareas of a particular class. Make up the class name and the numbers. | $("textarea.expandable").attr("rows", "8") .attr("cols", "100"); | ^ *\$\(•textarea\..+•\)\.attr\(•rows•, •[0-9]+•\)\.attr\(•cols•, •[0-9]+•\); *$ | |
When the user clicks in any textarea, remove its width and height attributes. | $("textarea").on("focus", function() { $(this).removeAttr("rows").removeAttr("cols"); }); | ^ *\$\(•textarea•\)\.on\(\•focus•, function\(\) {\n *\$\(this\)\.removeAttr\(•rows•\)\.removeAttr\(•cols•\);\n *}\); *$ | |
Change the link whose id is "info" to loris.com. | $("a#info").attr("href", "http://www.loris.com"); | ^ *\$\(•a#info•\)\.attr\(•href•, •http:\/\/www\.loris\.com•\); *$ | |
Change the link whose id is "info" to about.html. | $("a#info").attr("href", "about.html"); | ^ *\$\(•a#info•\)\.attr\(•href•, •about\.html•\); *$ | |
Change the link whose id is "info" to about.html at loris.com. | $("a#info").attr("href", "http://www.loris.com/about.html"); | ^ *\$\(•a#info•\)\.attr\(•href•, •http:\/\/www\.loris\.com\/about\.html•\); *$ | |
Change the width and height of all textareas. Make up the numbers. | $("textarea").attr("rows", "8").attr("cols", "100"); | ^ *\$\(•textarea•\)\.attr\(•rows•, •[0-9]+•\)\.attr\(•cols•, •[0-9]+•\); *$ | |
Change the width and height of textareas of a particular class. Make up the class name and the numbers. | $("textarea.expandable").attr("rows", "8") .attr("cols", "100"); | ^ *\$\(•textarea\..+•\)\.attr\(•rows•, •[0-9]+•\)\.attr\(•cols•, •[0-9]+•\); *$ | |
When the user clicks in any textarea, remove its width and height attributes. | $("textarea").on("focus", function() { $(this).removeAttr("rows").removeAttr("cols"); }); | ^ *\$\(•textarea•\)\.on\(\•focus•, function\(\) {\n *\$\(this\)\.removeAttr\(•rows•\)\.removeAttr\(•cols•\);\n *}\); *$ | |
http://jsfiddle.net/ASmarterWayToLearn/e622vq5u/ | |||
http://jsfiddle.net/ASmarterWayToLearn/0c927y37/ |