<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jquery动态添加元素-事件绑定</title>
<script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
<script type="text/javascript">
//事件绑定-事件委托
$(function(){
$("body").delegate('.wang', 'click', function(){
var addDom='<div class="wang" style="height: 20px; 30px; color:#fff;background:#333;">ddd</div>';
$(this).after(addDom);
});
});
</script>
</head>
<body>
<div class="wang" style="height: 20px; 30px; color:#fff; background:#333;">
1111
</div>
</body>
</html>