0
我想找到下一個匹配的類,並且使用的none
一個CSS display
刪除它,如果每個.col-sm-4
內img
有sold
子串在其alt
屬性。如果IMG ALT標籤包括「賣」查找下一個匹配的類
的jQuery:
$('.col-sm-4').each(function() {
if ($("img [alt=sold]")) {
$(this).next('.quick-enquire a').css('display', 'none');
}
});
HTML:
<div class="col-sm-4 col-lg-4">
<a href="http://localhost:8888/?attachment_id=420" class="thumbnail img-thumbnail" data-slb-group="28_auto_1" data-slb-active="1" data-slb-internal="420">
<img width="300" height="300" src="http://localhost:8888/wp-content/uploads/2014/07/img.jpg" class="attachment-medium" alt="sold" />
</a>
<div class="pic-options">
<div class="pull-right">
<span class="quick-enquire"><a href="#">Enquire about this painting</a></span>
<span id="isSold">sold</span>
</div>
</div>
太謝謝你了!一直在掙扎幾個小時!鍛鍊了魅力......乾杯! – user3927582 2014-09-01 21:29:02