div1.id = "div1"
var div2 = document.createElement("div")
div2.id ="div2"
document.body.appendChild(div1)
div1.appendChild(div2)
html:
<div class="main"><input type="button" value="添加" class="btn" />
</div>
JQ:
$(document).ready(function(){$(".btn").click(function(){
var html = '<div style="width:200px height:30px border:1px dashed red margin-bottom:20px"></div>'
$(".main").append(html)
})
})
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)