admin管理员组文章数量:1394062
I want to remove all <br>
tags in the div class category alternate
but for some reason I can't get it work.
Here is what I got so far:
$('div.category alternate').find('br').remove();
I want to remove all <br>
tags in the div class category alternate
but for some reason I can't get it work.
Here is what I got so far:
$('div.category alternate').find('br').remove();
Share
Improve this question
edited Sep 30, 2012 at 18:05
Felix Kling
818k181 gold badges1.1k silver badges1.2k bronze badges
asked Sep 30, 2012 at 17:50
user1685565user1685565
3372 gold badges5 silver badges16 bronze badges
2
- That should work, your selector is wrong. What's the HTML look like? – sachleen Commented Sep 30, 2012 at 17:52
- 1 What do you think he means? You have some HTML being sent to the browser, and you want to modify the elements, right? Well, "What does the HTML look like?" – I Hate Lazy Commented Sep 30, 2012 at 18:06
3 Answers
Reset to default 6If your HTML looks like this:
<div class="category alternate">
whatever<br>
</div>
then you want this:
$('div.category.alternate br').remove();
On the other hand, if your HTML looks like this:
<div class="category">
<div class="alternate">
whatever<br>
</div>
</div>
then you want this:
$('div.category .alternate br').remove();
There is no such thing as an <alternate>
tag.
$('div.category alternate')
tries to find all alternate
tags inside div
with class category
. Maybe you ment $('div.category .alternate')
本文标签: javascriptRemove ltbrgt in a specific div classStack Overflow
版权声明:本文标题:javascript - Remove <br> in a specific div class - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744613458a2615793.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论