I would like to remove the p tag that directly follows a div using jquery. Here is my 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
.
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!
This should work:
$('.fbcommentbox').next('p').remove();
We select the div, then use next
to get the next element.