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
What is the keyword for removing an attribute? | removeAttr | ^ *removeAttr *$ | |
Fill in the blank to set the width at 300px. | $(this).attr("width", ____); | "300" | ^ *•300• *$ |
Fill in the blank to change the alternate text. Make up the text. | $(this).attr(___________); | "alt", "loris" | ^ *•alt•, •.+• *$ |
Fill in the blank to remove the height attribute. | $(this)._____________ | removeAttr("height"); | ^ *removeAttr\(•height•\); *$ |
5. Drag-and-drop: Holding down the left mouse button, drag the pieces of code onto the screen to replace an image and remove the alternate text. | $("img#dog").attr("src", "cat.jpg").removeAttr("alt"); | ||
Select $(this). Remove its width and height. | $(this).removeAttr("width").removeAttr("height"); | $(this)`.`remove`Attr`(`"`width`"`)`.`remove`Attr`(`"`height`"`)`; | |
Select $(this). Change its height to 50px. | $(this).attr("height", "50"); | ||
Remove the height attribute of an image. Make up the id of the image. | $("img#cat").removeAttr("height"); | ^ *\$\(•img#.+•\)\.removeAttr\(•height•\); *$ | |
Change the width and height of an image. Make up the id of the image and the width and height. | $("img#loris").attr("width", "200").attr("height", "300"); | ^ *\$\(•img#.+•\)\.attr\(•width•, •[0-9]+•\)\.attr\(•height•, •[0-9]+•\); *$ | |
Assign width and height numbers to variables. Make up the variable names and the numbers. Use these variables to change the width and height of $(this). | var w = "250"; var h = "300"; $(this).attr("width", w).attr("height", h); | ^ *var ([a-zA-Z$_][a-zA-Z$_0-9]*) = •[0-9]+•;\n *var ([a-zA-Z$_][a-zA-Z$_0-9]*) = •[0-9]+•;\n *\$\(this\)\.attr\(•width•, \1\)\.attr\(•height•, \2\); *$ | |
Remove the width attribute from two images. Make up their ids. | $("img#first, img#second").removeAttr("width"); | ^ *\$\(•img#.+, img#.+•\)\.removeAttr\(•width•\); *$ | |
Assign the width and height attributes to variables. Remove them from all images, using the variables. Make up the variable names. | var w = "width"; var h = "height"; $("img").removeAttr(w).removeAttr(h); | ^ *var ([a-zA-Z$_][a-zA-Z$_0-9]*) = •width•;\n *var ([a-zA-Z$_][a-zA-Z$_0-9]*) = •height•;\n *\$\(•img•\)\.removeAttr\(\1\)\.removeAttr\(\2\); *$ | |
Select $(this). Change its height to 50px. | $(this).attr("height", "50"); | ^ *\$\(this\)\.attr\(•height•, •50•\); *$ | |
Remove the height attribute of an image. Make up the id of the image. | $("img#cat").removeAttr("height"); | ^ *\$\(•img#.+•\)\.removeAttr\(•height•\); *$ | |
Change the width and height of an image. Make up the id of the image and the width and height. | $("img#loris").attr("width", "200").attr("height", "300"); | ^ *\$\(•img#.+•\)\.attr\(•width•, •[0-9]+•\)\.attr\(•height•, •[0-9]+•\); *$ | |
Assign width and height numbers to variables. Make up the variable names and the numbers. Use these variables to change the width and height of $(this). | var w = "250"; var h = "300"; $(this).attr("width", w).attr("height", h); | ^ *var ([a-zA-Z$_][a-zA-Z$_0-9]*) = •[0-9]+•;\n *var ([a-zA-Z$_][a-zA-Z$_0-9]*) = •[0-9]+•;\n *\$\(this\)\.attr\(•width•, \1\)\.attr\(•height•, \2\); *$ | |
Remove the width attribute from two images. Make up their ids. | $("img#first, img#second").removeAttr("width"); | ^ *\$\(•img#.+, img#.+•\)\.removeAttr\(•width•\); *$ | |
Assign the width and height attributes to variables. Remove them from all images, using the variables. Make up the variable names. | var w = "width"; var h = "height"; $("img").removeAttr(w).removeAttr(h); | ^ *var ([a-zA-Z$_][a-zA-Z$_0-9]*) = •width•;\n *var ([a-zA-Z$_][a-zA-Z$_0-9]*) = •height•;\n *\$\(•img•\)\.removeAttr\(\1\)\.removeAttr\(\2\); *$ | |
http://jsfiddle.net/ASmarterWayToLearn/nw57w5ss/ | |||
http://jsfiddle.net/ASmarterWayToLearn/nx57rwhe/ |