javascript - 如何删除重复行中 hr 的最后一个孩子?
问题描述
我正在尝试找到最有效的方法来删除重复行中的最后两个孩子或最后两个小时。请参阅下面的图像和代码。希望你们能帮助我。谢谢!
在这张图片中,我想删除最后一个孩子 hr。在这张图片中,我想删除最后一个孩子 hr。
下面是我的jQuery:
$('.updates-list').find('.row:last').removeClass('.hr_style2');
$('.promo-list').children('.col-lg-12').last().removeClass('.hr_style2');
CSS:
.hr_style2 {
border-bottom: solid 1px #dcdcdc;
clear: both;
margin: 0 !important;
}
.promo-list .row:last-child .hr_style2{
display: none;
visibility: hidden;
}
这是我的 HTML:
<div class="promo-list">
<div class="other-updates text-center">Other Updates</div>
<div class="row">
<div class="col-lg-12">
<div class="col-lg-6">
<div class="updates-list clearfix">
<div id="views-bootstrap-grid-2" class="views-bootstrap-grid-plugin-style">
<div class="row">
<div class="updates-inner-list col-xs-12 col-sm-12 col-md-12 col-lg-12">
<div> <span><a href="path">
<img typeof="foaf:Image" class="img-responsive" src="assets/images/homepage/home-bg.png" alt="">
</a>
<div class="updates-title"><a href="#">5 secrets to packing light for out-of-town trips</a></div>
<div class="updates-details"><p>As soon as vacation season rolls in, people start making plans for out-of-town trips. But before they can enjoy a grand vacay, they first have to conquer… <a href="#" class="views-more-link">Read More</a></p>
</div>
<hr class="hr_style2"></span> </div>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-6">
<div class="updates-list clearfix">
<div id="views-bootstrap-grid-2" class="views-bootstrap-grid-plugin-style">
<div class="row">
<div class="updates-inner-list col-xs-12 col-sm-12 col-md-12 col-lg-12">
<div> <span><a href="path">
<img typeof="foaf:Image" class="img-responsive" src="assets/images/homepage/home-bg.png" alt="">
</a>
<div class="updates-title"><a href="#">Comfort meets Nostalgia, Divine, and the Magical</a></div>
<div class="updates-details"><p>Urban comforts enhanced by retro-chic details are making newly opened Summit Hotel Magnolia (SHM... <a href="#" class="views-more-link">Read More</a></p>
</div>
<hr class="hr_style2"></span> </div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="col-lg-6">
<div class="updates-list clearfix">
<div id="views-bootstrap-grid-2" class="views-bootstrap-grid-plugin-style">
<div class="row">
<div class="updates-inner-list col-xs-12 col-sm-12 col-md-12 col-lg-12">
<div> <span><a href="path">
<img typeof="foaf:Image" class="img-responsive" src="assets/images/homepage/home-bg.png" alt="">
</a>
<div class="updates-title"><a href="#">5 secrets to packing light for out-of-town trips</a></div>
<div class="updates-details"><p>As soon as vacation season rolls in, people start making plans for out-of-town trips. But before they can enjoy a grand vacay, they first have to conquer… <a href="#" class="views-more-link">Read More</a></p>
</div>
<hr class="hr_style2"></span> </div>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-6">
<div class="updates-list clearfix">
<div id="views-bootstrap-grid-2" class="views-bootstrap-grid-plugin-style">
<div class="row">
<div class="updates-inner-list col-xs-12 col-sm-12 col-md-12 col-lg-12">
<div> <span><a href="#">
<img typeof="foaf:Image" class="img-responsive" src="assets/images/homepage/home-bg.png" alt="">
</a>
<div class="updates-title"><a href="#">Comfort meets Nostalgia, Divine, and the Magical</a></div>
<div class="updates-details"><p>Urban comforts enhanced by retro-chic details are making newly opened Summit Hotel Magnolia (SHM... <a href="#" class="views-more-link">Read More</a></p>
</div>
<hr class="hr_style2"></span> </div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>