-
Notifications
You must be signed in to change notification settings - Fork 0
/
8_attr filter.html
77 lines (69 loc) · 2.58 KB
/
8_attr filter.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<link rel="stylesheet" href="css/style.css" />
</head>
<body>
<h3>属性过滤选择器.</h3>
<!-- 测试的元素 -->
<div class="one" id="one" >id为one,class为one的div
<div class="mini">class为mini</div>
</div>
<div class="one" id="two" title="test" >id为two,class为one,title为test的div.
<div class="mini" title="other">class为mini,title为other</div>
<div class="mini" title="test">class为mini,title为test</div>
</div>
<div class="one">
<div class="mini">class为mini</div>
<div class="mini">class为mini</div>
<div class="mini">class为mini</div>
<div class="mini"></div>
</div>
<div class="one">
<div class="mini">class为mini</div>
<div class="mini">class为mini</div>
<div class="mini">class为mini</div>
<div class="mini" title="tesst">class为mini,title为tesst</div>
</div>
<div style="display:none;" class="none">style的display为"none"的div</div>
<div class="hide">class为"hide"的div</div>
<div>包含input的type为"hidden"的div<input type="hidden" size="8"/>
</div>
<span id="mover">正在执行动画的span元素.</span>
<br /><br />
<h1 style="clear:both">
<input type="button" value="选取title属性以te开头的div" id="btn1"/>
<input type="button" value="选取title属性以est结尾的div" id="btn2"/>
<input type="button" value="选取包含title属性的div" id="btn3"/>
<input type="button" value="选取title属性等于test的div" id="btn4"/>
<input type="button" value="选取title属性不等于test的div" id="btn5"/>
<input type="button" value="选取title属性包含es的div" id="btn6"/>
<input type="button" value="选取包含id属性且title属性值包含es的div" id="btn7"/>
</h1>
<script src="js/jquery-1.11.3.js"></script>
<script>
$("#btn1").click(function(){
$("div[title^=te]").css("border","1px solid red")
})
$("#btn2").click(function(){
$("div[title$=est]").css("border","1px solid red")
})
$("#btn3").click(function(){
$("div[title]").css("border","1px solid red")
})
$("#btn4").click(function(){
$("div[title=test]").css("border","1px solid red")
})
$("#btn5").click(function(){
$("div[title!=test]").css("border","1px solid red")
})
$("#btn6").click(function(){
$("div[title*=es]").css("border","1px solid red")
})
$("#btn7").click(function(){
$("div[id][title*=es]").css("border","1px solid red")
})
</script>
</body>
</html>