Skip to content

Commit 996f601

Browse files
danheberdenajpiano
authored andcommitted
Add attributes and traversing to jquery-basics
1 parent d5c69cb commit 996f601

File tree

2 files changed

+10
-19
lines changed

2 files changed

+10
-19
lines changed

content/jquery-fundamentals/jquery-basics/attributes.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
---
2-
chapter : jquery-basics
3-
section : 4
4-
title : Attributes
5-
attribution: jQuery Fundamentals
2+
chapter : "jqfundamentals"
3+
section : "4"
4+
title : "Attributes"
65
---
76
## Attributes
87

98
An element's attributes can contain useful information for your application, so it's important to be able to get and set them.
109

11-
The `$.fn.attr` method acts as both a getter and a setter.
12-
As with the `$.fn.css` method, `$.fn.attr` as a setter can accept either a key and a value, or an object containing one or more key/value pairs.
10+
The `$.fn.attr` method acts as both a getter and a setter. As with the `$.fn.css` method, `$.fn.attr` as a setter can accept either a key and a value, or an object containing one or more key/value pairs.
1311

1412
<div class="example" markdown="1">
1513
Setting attributes
@@ -21,9 +19,7 @@ Setting attributes
2119
});
2220
</div>
2321

24-
This time, we broke the object up into multiple lines.
25-
Remember, whitespace doesn't matter in JavaScript, so you should feel free to use it liberally to make your code more legible!
26-
You can use a minification tool later to strip out unnecessary whitespace for production.
22+
This time, we broke the object up into multiple lines. Remember, whitespace doesn't matter in JavaScript, so you should feel free to use it liberally to make your code more legible! You can use a minification tool later to strip out unnecessary whitespace for production.
2723

2824
<div class="example" markdown="1">
2925
Getting attributes

content/jquery-fundamentals/jquery-basics/traversing.md

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
---
2-
chapter : jquery-basics
3-
section : 5
4-
title : Traversing
5-
attribution: jQuery Fundamentals
2+
chapter : "jqfundamentals"
3+
section : "5"
4+
title : "Traversing"
65
---
76
## Traversing
87

@@ -13,8 +12,7 @@ For complete documentation of jQuery traversal methods, visit [http://api.jquery
1312
<div class="note" markdown="1">
1413
### Note
1514

16-
Be cautious with traversing long distances in your documents — complex traversal makes it imperative that your document's structure remain the same, something that's difficult to guarantee even if you're the one creating the whole application from server to client.
17-
One- or two-step traversal is fine, but you generally want to avoid traversals that take you from one container to another.
15+
Be cautious with traversing long distances in your documents — complex traversal makes it imperative that your document's structure remain the same, something that's difficult to guarantee even if you're the one creating the whole application from server to client. One- or two-step traversal is fine, but you generally want to avoid traversals that take you from one container to another.
1816
</div>
1917

2018
<div class="example" markdown="1">
@@ -27,10 +25,7 @@ Moving around the DOM using traversal methods
2725
$('li.selected').siblings();
2826
</div>
2927

30-
You can also iterate over a selection using `$.fn.each`.
31-
This method iterates over all of the elements in a selection, and runs a function for each one.
32-
The function receives the index of the current element and the DOM element itself as arguments.
33-
Inside the function, the DOM element is also available as `this` by default.
28+
You can also iterate over a selection using `$.fn.each`. This method iterates over all of the elements in a selection, and runs a function for each one. The function receives the index of the current element and the DOM element itself as arguments. Inside the function, the DOM element is also available as `this` by default.
3429

3530
<div class="example" markdown="1">
3631
Iterating over a selection

0 commit comments

Comments
 (0)