如何删除具有特定类名的所有div? [英] How can i delete all divs with a certain class name?

查看:538
本文介绍了如何删除具有特定类名的所有div?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用jquery,删除具有特定类名的所有div的最佳方法是什么? (我不想只是隐藏div而是将其完全删除).因此,如果我有此代码:

Using jquery, what is the best way to delete all divs with a certain class name ? (I don't want to just hide the div but fully delete it). So if I have this code:

<div class="Test" ><div class="ABC" ><div class="Test" >

当我在class ="Test"处调用此方法后,我只会看到:

after I call this method where class = "Test", i would just see:

<div class="ABC" >

推荐答案

$("div.Test").remove();

那样就可以了.

这篇关于如何删除具有特定类名的所有div?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆