$(selector).remove(selector)
参数 | 说明 |
selector | 是可选参数。它指定是否删除一个或多个元素。如果必须删除多个元素,则应使用逗号(,)分隔它们。 |
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>remove demo</title>
<style>
p {
background: pink;
margin: 6px 0;
}
</style>
<script src="/jquery-1.10.2.js"></script>
</head>
<body>
<p>Hello Guys!</p>
This is bianchenghao6.com<br/>
<p>A place for all technology.</p>
<button>Execute remove() method on paragraphs</button>
<script>
$("button").click(function() {
$("p").remove();
});
</script>
</body>
</html>
Hello Guys!
This is bianchenghao6.com
A place for all technology.
<!DOCTYPE html>
<html>
<head>
<script src="/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("p").remove();
});
});
</script>
</head>
<body>
<p>Welcome Guys!</p>
<p><b>This is bianchenghao6.com</b></p>
<button>Click here to execute remove() method</button>
</body>
</html>
Welcome Guys!
This is bianchenghao6.com