我試圖分離和前面加上一個元素同級元素,什麼也沒發生,我沒有收到在控制檯中的任何錯誤或者。的jQuery移動元素兄弟不工作
這裏是我的HTML:
<div class="wp-posts-carousel-container">
<div class="wp-posts-carousel-image"><a href=" /?event=7-nights-450-2"
title="Read more 7 Nights - £450"><img alt="7 Nights - £450"
style="max-width:100%;max-height:100%"
src=" /wp-content/uploads/2016/10/5e87ac4c-5a68-4206-bebc-51163a92a204-150x150.jpg"></a>
</div>
<div class="wp-posts-carousel-details"><h3 class="wp-posts-carousel-title"><a
href=" /?event=7-nights-450-2" title="7 Nights - £450">7 Nights - £450</a></h3>
<div class="wp-posts-carousel-desc"><span class="event-date-visit" style="font-size: 10pt;"><strong>16th Feb to 23rd Feb 2017</strong></span>
<ul class="chevrons icon ">
<li><i class="fa fa-check"></i><i class="icon icon-envelope-alt"></i> 4* Hotel</li>
<li><i class="fa fa-check"></i><i class="icon icon-film"></i> Daily breakfast & dinner buffet</li>
<li><i class="fa fa-check"></i><i class="icon icon-envelope-alt"></i> All ground transfers</li>
<li><i class="fa fa-check"></i><i class="icon icon-film"></i> Guided tours to many historical sites</li>
</ul>
Flights not included - approx £200
</div>
<p class="wp-posts-carousel-buttons"><a href="/contact"
class="wp-posts-carousel-more-button button btn btn-primary"
title="Read more 7 Nights - £450">Enquire Now</a></p>
<p></p></div>
</div>
的jQuery:
$(".event-date-visit").each(function() {
$(this).detach().prependTo($(this).closest('.wp-posts-carousel-image'));
});
這根本不做任何事,任何人都知道發生了什麼?
這一個爲我工作,沒有其他答案的工作。 – user3574492