Skip to content

Commit 72f1b23

Browse files
committed
修正dom操作
1 parent 7655755 commit 72f1b23

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

慕课网教程案例/jQuery入门教程/jQuery的节点操作/DOM包裹wrapAll()方法.html

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
.left div,
1616
.right div {
1717
width: 100px;
18-
height: 120px;
18+
/*height: 120px;*/
1919
padding: 5px;
2020
margin: 5px;
2121
float: left;
@@ -26,10 +26,17 @@
2626
.right div {
2727
background: yellow;
2828
}
29+
30+
p {
31+
border: 1px solid red;
32+
}
33+
34+
a {
35+
border: 1px solid blue;
36+
}
2937
</style>
3038
</head>
3139

32-
3340
<body>
3441
<h2>DOM包裹wrapAll()方法</h2>
3542
<div class="left">
@@ -44,12 +51,10 @@ <h2>DOM包裹wrapAll()方法</h2>
4451
<a>a元素</a>
4552
<a>a元素</a>
4653
</div>
47-
48-
4954
<script type="text/javascript">
5055
$(".aaron1").on('click', function() {
5156
//给所有p元素,增加父容器div
52-
$('p').wrapAll('<div></div>');
57+
$('p').wrapAll('<div></div>');
5358
})
5459
</script>
5560
<script type="text/javascript">

慕课网教程案例/jQuery入门教程/jQuery遍历/children方法.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
display: block;
2626
}
2727
</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>
2929
</head>
3030

3131
<body>
@@ -53,21 +53,21 @@ <h2>children方法()</h2>
5353
</ul>
5454
</div>
5555
</div>
56-
<button>点击:children无参数</button>
57-
<button>点击:children传递表达式</button>
56+
<button id="bt1">点击:children无参数</button>
57+
<button id="bt2">点击:children传递表达式</button>
5858
<script type="text/javascript">
59-
$("button:first").click(function() {
59+
$("#bt1").click(function() {
6060
//找到所有class=div的元素
6161
//然后找到其对应的子元素,加上一个红色边框
62-
$('.div').children().css('border', '1px solid red')
62+
$('.div').children().css('border', '3px solid red')
6363
})
6464
</script>
6565

6666
<script type="text/javascript">
67-
$("button:last").click(function() {
67+
$("#bt2").click(function() {
6868
//找到所有class=div的元素
6969
//找到其对应的子元素ul,然后筛选出最后一个,给边宽加上颜色
70-
$('.div').children(':last').css('border', '1px solid blue')
70+
$('.div').children(':last').css('border', '3px solid blue')
7171
})
7272
</script>
7373

0 commit comments

Comments
 (0)