Skip to content

Commit 3a3a079

Browse files
committed
Merge pull request #156 from steverob/patch-6
fixes and updates to js lesson 3
2 parents 53b6f94 + fb01c9c commit 3a3a079

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

js/lesson3/tutorial.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ $("div") // all div elemenets
3131
$("#container") // an element with the ID container
3232
$(".total") // elements with the class total
3333
$("ol#items") // ordered list elements with the ID items
34-
$("ol#items li") // list elements, within an ordered list with the id colors
34+
$("ol#items li") // list elements, within an ordered list with the ID items
3535
```
3636

3737
You can also use CSS3 selectors.
@@ -45,10 +45,10 @@ $("li:first-child"); // the first child in a list
4545

4646
##Get and set HTML attributes `attr()`
4747

48-
Using `attr(attributeName)` you can retrieve the value of an attribute.
48+
Using `attr("attributeName")` you can retrieve the value of an attribute.
4949

5050
You can use the same method to set the value of an attribute:
51-
`attr(attributeName, value)`. Many jQuery methods can be used to both get and
51+
`attr("attributeName", value)`. Many jQuery methods can be used to both get and
5252
set.
5353

5454
```js
@@ -148,7 +148,7 @@ $(document).ready(function() {
148148
});
149149
```
150150

151-
Make a note of this. You should **always** use it or else your bindings won't work and the functions will run when you are loading the page.
151+
Make a note of this. Wrapping your event listeners and other code within this make's sure they are executed only after all the DOM elements are loaded and ready. You should **always** use it or else your bindings won't work and the functions will run when you are loading the page.
152152

153153
#Exercise 1: Build a wish list
154154

@@ -380,7 +380,7 @@ Set `.preview`'s background color, to the random color code.
380380

381381
###Restrict number of displayed boxes
382382

383-
We only want to be able to add 16 colors to our favorite list. To do that, we can update the code handling the **click** event and check that the length of `$("#colors .item")` is **equal** than 16. If it's not, remove the last element.
383+
We only want to be able to add 16 colors to our favorite list. To do that, we can update the code handling the **click** event and check that the length of `$("#colors .item")` is **less** than 16. If it's not, remove the last element.
384384

385385
This way, when the list is full, we remove a box and add another one.
386386

0 commit comments

Comments
 (0)