当前位置: 移动技术网 > IT编程>开发语言>JavaScript > jquery使用remove()方法删除指定class子元素

jquery使用remove()方法删除指定class子元素

2019年05月17日  | 移动技术网IT编程  | 我要评论

本文实例讲述了jquery使用remove()方法删除指定class子元素的方法。分享给大家供大家参考。具体实现方法如下:

<!doctype html>
<html>
<head>
<script src="js/jquery.min.js">
</script>
<script>
$(document).ready(function(){
 $("button").click(function(){
  $("p").remove(".italic");
 });
});
</script>
</head>
<body>
<p>this is a paragraph in the p.</p>
<p class="italic"><i>this is another paragraph in the p.</i></p>
<p class="italic"><i>this is another paragraph in the p.</i></p>
<button>remove all p elements with class="italic"</button>
</body>
</html>

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网