我想删除div类<br>
中的所有category alternate
标记,但出于某种原因,我无法使其正常工作。
这是我到目前为止所得到的:
$('div.category alternate').find('br').remove();
答案 0 :(得分:6)
如果你的HTML看起来像这样:
<div class="category alternate">
whatever<br>
</div>
然后你想要这个:
$('div.category.alternate br').remove();
另一方面,如果你的HTML看起来像这样:
<div class="category">
<div class="alternate">
whatever<br>
</div>
</div>
然后你想要这个:
$('div.category .alternate br').remove();
答案 1 :(得分:2)
没有<alternate>
标签。
答案 2 :(得分:2)
$('div.category alternate')
尝试使用类alternate
查找div
内的所有category
个标记。也许你会$('div.category .alternate')