jquery选择器建议 [英] jquery selector suggestion
问题描述
大家好,
i想删除第一个jcrop-holder类的所有div标签,除了图像标签
< p >
< div < span class =code-attribute> class = jcrop-holder >
< div < span class =code-keyword>> < / div >
< div > < / div >
< img < span class =code-attribute> src = img.png / >
< / div >
< div class = jcrop-holder >
< div > < / d iv >
< div > < / div >
< / div >
< / p >
预期输出< br $>
===============
< p >
< ; div class < span class =code-keyword> = jcrop-holde r >
< img src = img.png / < span class =code-keyword>>
< / div >
< div class = jcrop-holder >
< ; div > < / div >
< div > < / div >
< / div >
< / p >
i使用了这个,但我得不到结果 - >>
$(。jcrop-holder:first)。not(img)。 remove();
提前感谢
(。jcrop-holder:first) .not(img)。remove();
提前感谢
试试以下代码
hello all ,
i want to remove all div tag of first jcrop-holder class except image tag
<p>
<div class="jcrop-holder">
<div></div>
<div></div>
<img src="img.png" />
</div>
<div class="jcrop-holder">
<div></div>
<div></div>
</div>
</p>
expected output
===============
<p>
<div class="jcrop-holder">
<img src="img.png" />
</div>
<div class="jcrop-holder">
<div></div>
<div></div>
</div>
</p>
i used this one but i cant get result -->>
$(".jcrop-holder:first").not("img").remove();
thanks in advance(".jcrop-holder:first").not("img").remove();
thanks in advanceTry below code
('div.jcrop-holder:first').find('div').remove();
这篇关于jquery选择器建议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!