Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/90.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 当父元素具有jQuery元素时,如何删除特定元素?_Javascript_Html_Jquery_Css - Fatal编程技术网

Javascript 当父元素具有jQuery元素时,如何删除特定元素?

Javascript 当父元素具有jQuery元素时,如何删除特定元素?,javascript,html,jquery,css,Javascript,Html,Jquery,Css,这是我的代码: jQuery('.page-id-9.woocommerce td.tdclass:not(.variation')).remove() td{ 边框:1px实心#ccc; } #1 钱包 $45 #2 选择类别: 第一类 选择产品: 产品1 链接: 钱包2 $35 使用has()方法(或:has()选择器)过滤存在所需类的类,然后find()删除另一个span jQuery('.page-id-9 .woocommerce td.tdclass') .ha

这是我的代码:

jQuery('.page-id-9.woocommerce td.tdclass:not(.variation')).remove()
td{
边框:1px实心#ccc;
}

#1
钱包
$45
#2
选择类别:
第一类

选择产品: 产品1

链接:

钱包2 $35
使用
has()
方法(或
:has()
选择器)过滤存在所需类的类,然后
find()
删除另一个span

jQuery('.page-id-9 .woocommerce td.tdclass')
        .has('dl.variation')
        .find('.other_item')
        .remove();
或者更简单一点,以变体类为目标,使用
sillides()


使用has()的示例

jQuery('.page-id-9.woocommerce td.tdclass')
.has('dl.variation')
.find(“.other_item”)
.remove()
td{
边框:1px实心#ccc;
}

#1
钱包
$45
#2
选择类别:
第一类

选择产品: 产品1

链接:

钱包2 $35
jQuery('.page-id-9 .woocommerce td.tdclass dl.variation')
         .siblings('.other_item')
         .remove();