-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathsample008.html
40 lines (40 loc) · 1.23 KB
/
sample008.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<!DOCTYPE html>
<html lang="en">
<body>
<style>
.last
{
background: #900;
}
</style>
<ul id="list">
<li></li>
<li>
<ul>
<li></li>
<li></li>
<li></li>
</ul>
</li>
<li></li>
<li></li>
</ul>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script> (function ($) {
$('#list') // Original wrapper set
.find('> li') // Destructive method
.filter(':last') // Destructive method
.addClass('last')
.end() // End .filter(':last')
.find('ul') // Destructive method
.css('background', '#ccc')
.find('li:last') // Destructive method
.addClass('last')
.end() // End .find('li:last')
.end() // End .find('ul')
.end() // End .find('> li')
.find('li') // Back to the orginal $('#list')
.append('I am an <li>');
})(jQuery); </script>
</body>
</html>