append与after的去呗

JQuery点滴
append vs after
Talk is cheap,show me the code!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script>
</head>
<body>
<div class="append">append</div>
<div class="after">after</div>
<script>
$('.append').append('<p>this is test append</p>');
$('.after').after('<p>this is test after</p>');
</script>
</body>
</html>

append vs after
查看DOM结构可知,append是附加到内容里面,after是附加到内容后面