导读:jQuery删除HTML元素的方法只需要用到remove()就可以,具体的看以下例子。<!DOCTYPE html><html><head><meta http-equiv="content-type" ...
jQuery删除HTML元素的方法只需要用到
remove()就可以,具体的看以下例子。
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>B5教程网</title>
<script type="text/javascript" src="http://www.bcty365.com/statics/js/bcty365_js/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("#phpboys").remove();
});
});
</script>
</head>
<body>
<div id="phpboys">
jQuery删除html元素的方法
<p>www.bcty365.com</p>
</div>
<button>删除 div 元素</button>
</body>
</html>