forked from fanspaceshow/CodeTemplate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoperate_dom.html
51 lines (43 loc) · 1.14 KB
/
operate_dom.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
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>jquery-upload-file demo</title>
<script src="http://7xqp2l.com1.z0.glb.clouddn.com/jquery-1.11.2.min.js" type="text/javascript"></script>
<style type="text/css">
#content {
width: 600px;
margin: 0 auto;
}
.red_color{
color: red;
}
</style>
</head>
<body>
<div id="content"></div>
<script>
var content = $("#content");
$("<h1 />", {
"text":"Hello World",
"class" : "red_color"
}).appendTo(content);
var ulObj = $("<ul />",{
"id" : "ulObj"
}).appendTo(content);
for(var i = 0; i < 4; i++) {
$("<li />", {
"text" : "这是项目" + i
}).appendTo(ulObj);
}
var btnObj = $("<button />", {
"text" : "点我删除列表",
"id" : "btnObj"
}).appendTo(content);
$("#btnObj").click(function(e) {
$("#ulObj").remove();
})
</script>
</body>
</html>