<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title></title>
<script src="https://www.imooc.com/static/lib/jquery/1.9.1/jquery.js"></script>
<style>
.left,
.right {
300px;
height: 120px;
}
.left div,
.right div {
100px;
height: 90px;
padding: 5px;
margin: 5px;
float: left;
border: 1px solid #ccc;
}
.left div {
background: #bbffaa;
}
.right div {
background: yellow;
}
</style>
</head>
<body>
<h2>动态创建元素节点</h2>
<button>点击通过jQuery动态创建元素节点</button>
<script type="text/javascript">
$("button").on('click', function() {
var a = $("body");
var di=$("<div class='right'><div class='aaron'>动态创建DIV元素节点</div></div>")
a.append(di)
})
</script>
</body>
</html>