Reputation: 951
HTML:
<div class="section fp-section fp-table active"></div>
<div class="section fp-section fp-table"></div>
<div class="section fp-section fp-table"></div>
<div class="section fp-section fp-table"></div>
<div class="section fp-section fp-table"></div>
All five divs are exactly the same and just add 'active' pending on which div is selected. How would I go about removing the forth div? I've tried nth-child and displaying none, but had no luck.
Upvotes: 0
Views: 476
Reputation: 1658
nth-child worked fine for me
div:nth-child(4) {
display: none;
}
http://codepen.io/anon/pen/hIyDm
Upvotes: 0
Reputation: 8580
Here is alternative way to achieve this:
div:nth-last-child(2) {
display: none;
}
Hope it also helps!
Upvotes: 0
Reputation: 2670
Jquery Version
$('div:nth-child(4)').remove();
You can also hide() instead of remove() that works too.
Upvotes: 2