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 images whose width is 100 pixels. | $("img[width=______]") | '100' | ^ *◘100◘ *$ |
Fill in the blank to select images whose width is 100 pixels. | $("img[_________]") | width='100' | ^ *width=◘100◘ *$ |
Select images whose width is 100 pixels. | $("img[width='100']") | ^ *\$\(•img\[width=◘100◘\]•\) *$ | |
Select inputs whose value is 'single'. | $("input[value='single']") | ^ *\$\(•input\[value=◘single◘\]•\) *$ | |
5. Drag-and-drop: Holding down the left mouse button, drag the pieces of code onto the screen to make selected links open in a new window. | $("a[href='http://www.amazon.com']").attr("target", "_blank"); | ||
Select all list items in all unordered lists. Assign the class "inset" to them. | $("ul li").attr("class", "inset"); | $`(`"`ul`1spaceli`"`)`.`attr`(`"`class`"`comma`1space"`inset`"`)`; | |
Select all links to loris.html | $("a[href='loris.html']") | ||
Select all links to loris.html and change them to locust.html | $("a[href='loris.html']").attr("href", "locust.html"); | ^ *\$\(•a\[href=◘loris\.html◘\]•\)\.attr\(•href•, •locust\.html•\); *$ | |
Code the alternative to the following code. | $("p.primary") | $("p[class='primary']") | ^ *\$\(•p\[class=◘primary◘\]•\) *$ |
Select all images with a width of 100. | $("img[width='100']") | ^ *\$\(•img\[width=◘100◘\]•\) *$ | |
Using the type of selector that you learned in this chapter, select paragraphs of a particular class and remove those paragraphs. Make up the class name. | $("p[class='expendable']").remove(); | ^ *\$\(•p\[class=◘.+◘\]•\)\.remove\(\); *$ | |
If an image has particular alternative text, size it 50 pixels high. Make up the alternative text. | $("img[alt='loris']").attr("height", "50"); | ^ *\$\(•img\[alt=◘.+◘\]•\)\.attr\(•height•, •50•\); *$ | |
Select all links to loris.html | $("a[href='loris.html']") | ^ *\$\(•a\[href=◘loris\.html◘\]•\) *$ | |
Select all links to loris.html and change them to locust.html | $("a[href='loris.html']").attr("href", "locust.html"); | ^ *\$\(•a\[href=◘loris\.html◘\]•\)\.attr\(•href•, •locust\.html•\); *$ | |
Time goal: 25 seconds. Code the alternative to the following code. | $("p.primary") | $("p[class='primary']") | ^ *\$\(•p\[class=◘primary◘\]•\) *$ |
Select all images with a width of 100. | $("img[width='100']") | ^ *\$\(•img\[width=◘100◘\]•\) *$ | |
Using the type of selector that you learned in this chapter, select paragraphs of a particular class and remove those paragraphs. Make up the class name. | $("p[class='expendable']").remove(); | ^ *\$\(•p\[class=◘.+◘\]•\)\.remove\(\); *$ | |
If an image has particular alternative text, size it 50 pixels high. Make up the alternative text. | $("img[alt='loris']").attr("height", "50"); | ^ *\$\(•img\[alt=◘.+◘\]•\)\.attr\(•height•, •50•\); *$ | |
http://jsfiddle.net/ASmarterWayToLearn/uukqyfcu/ | |||
http://jsfiddle.net/ASmarterWayToLearn/hs3ysekm/ |