If I have a开发者_运维问答 div that contains other divs, how do I make it so I remove all the divs inside the original div? That might have been confusing, heres a code example:
<div class="test"><div class="delete"></div></div>
<div class="delete"></div>
How do I remove the 'delete' div thats INSIDE the 'test' div ONLY and still keep the one outside. Thanks!!
$('div.test').find('div.delete').remove();
should do the trick for you
actually a combination of both:
$('div.test div.delete').remove();
To delete any div inside
$('div.test div').remove()
If you're sure there won't be any other children elements that has a .delete
class, you can get away with this:
$('div.test > .delete').remove();
精彩评论