File tree Expand file tree Collapse file tree 2 files changed +17
-12
lines changed Expand file tree Collapse file tree 2 files changed +17
-12
lines changed Original file line number Diff line number Diff line change 15
15
.left div ,
16
16
.right div {
17
17
width : 100px ;
18
- height : 120px ;
18
+ /* height: 120px;*/
19
19
padding : 5px ;
20
20
margin : 5px ;
21
21
float : left;
26
26
.right div {
27
27
background : yellow;
28
28
}
29
+
30
+ p {
31
+ border : 1px solid red;
32
+ }
33
+
34
+ a {
35
+ border : 1px solid blue;
36
+ }
29
37
</ style >
30
38
</ head >
31
39
32
-
33
40
< body >
34
41
< h2 > DOM包裹wrapAll()方法</ h2 >
35
42
< div class ="left ">
@@ -44,12 +51,10 @@ <h2>DOM包裹wrapAll()方法</h2>
44
51
< a > a元素</ a >
45
52
< a > a元素</ a >
46
53
</ div >
47
-
48
-
49
54
< script type ="text/javascript ">
50
55
$ ( ".aaron1" ) . on ( 'click' , function ( ) {
51
56
//给所有p元素,增加父容器div
52
- $ ( 'p' ) . wrapAll ( '<div></div>' ) ;
57
+ $ ( 'p' ) . wrapAll ( '<div></div>' ) ;
53
58
} )
54
59
</ script >
55
60
< script type ="text/javascript ">
Original file line number Diff line number Diff line change 25
25
display : block;
26
26
}
27
27
</ style >
28
- < script src ="http://libs.baidu .com/jquery/1.9.1/jquery.js "> </ script >
28
+ < script src ="http://lib.sinaapp .com/js/ jquery/1.9.1/jquery-1.9.1.min .js "> </ script >
29
29
</ head >
30
30
31
31
< body >
@@ -53,21 +53,21 @@ <h2>children方法()</h2>
53
53
</ ul >
54
54
</ div >
55
55
</ div >
56
- < button > 点击:children无参数</ button >
57
- < button > 点击:children传递表达式</ button >
56
+ < button id =" bt1 " > 点击:children无参数</ button >
57
+ < button id =" bt2 " > 点击:children传递表达式</ button >
58
58
< script type ="text/javascript ">
59
- $ ( "button:first " ) . click ( function ( ) {
59
+ $ ( "#bt1 " ) . click ( function ( ) {
60
60
//找到所有class=div的元素
61
61
//然后找到其对应的子元素,加上一个红色边框
62
- $ ( '.div' ) . children ( ) . css ( 'border' , '1px solid red' )
62
+ $ ( '.div' ) . children ( ) . css ( 'border' , '3px solid red' )
63
63
} )
64
64
</ script >
65
65
66
66
< script type ="text/javascript ">
67
- $ ( "button:last " ) . click ( function ( ) {
67
+ $ ( "#bt2 " ) . click ( function ( ) {
68
68
//找到所有class=div的元素
69
69
//找到其对应的子元素ul,然后筛选出最后一个,给边宽加上颜色
70
- $ ( '.div' ) . children ( ':last' ) . css ( 'border' , '1px solid blue' )
70
+ $ ( '.div' ) . children ( ':last' ) . css ( 'border' , '3px solid blue' )
71
71
} )
72
72
</ script >
73
73
You can’t perform that action at this time.
0 commit comments