empty(x)方法是将所选中元素x的所有子节点删除,但不包括自身
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<script src="js/jquery-3.3.1.js"></script>
</head>
<body>
<p><span>I </span><b>Love You.</b></p>
<script>
$("p").empty();
</script>
</body>
</html>
remove(x)方法是将所选中的元素x删除,包括自身
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<script src="js/jquery-3.3.1.js"></script>
</head>
<body>
<p><span>I </span><b>Love You.</b></p>
<script>
$("p").remove();
</script>
<div><span>I </span><span class="letters">Love You.</span></div>
<script>
$("span").remove(".letters");//删除class为letters的所有span标签
</script>
</body>
</html>