使用 Jquery 在 div 后删除元素
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6497039/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Removing an element after a div with Jquery
提问by JCHASE11
I would like to remove the p tag that directly follows a div using jquery. Here is my HTML:
我想使用 jquery 删除直接跟在 div 后面的 p 标记。这是我的 HTML:
<div class="fbcommentbox"></div>
<p>Powered by <a href="http://pleer.co.uk/wordpress/plugins/facebook-comments/">Facebook Comments</a></p>
So in this case, all content inside the <p>
tags will be set to display:none
.
所以在这种情况下,<p>
标签内的所有内容都将被设置为display:none
.
This seems like it would be VERY simple to do in jquery but I cannot seem to put my finger on it. Any help would be great. Thanks!
这似乎在 jquery 中很简单,但我似乎无法理解它。任何帮助都会很棒。谢谢!
回答by Ben Everard
回答by rid
回答by AR.
$('.fbcommentbox').next().hide();
or $('.fbcommentbox').css('display','none')
.
$('.fbcommentbox').next().hide();
或$('.fbcommentbox').css('display','none')
。