我使用這個jQuery來選擇下一個列表元素並克隆類.slide-title
然後將它附加到另一個類。jQuery .next選擇器沒有找到類
$('li:visible').next('.slide-title').clone().appendTo('.feat_next');
這是HTML和jsfiddle如果我從.next()
功能它克隆了一個列表元素,並追加它刪除選擇。那麼爲什麼不找到.slide-title
課?
感謝
<ul id="slider" style="position: relative;">
<li style="position: absolute; top: 0px; left: 0px; display: block; z-index: 4; opacity: 1;">
<div class="content_left">
<p class="slide-date">July 2, 2012</p>
<h2><a class="slide-title" href="#">3333333333</a></h2>asdfasfasfasdfasdfasdfasdfasfdasfdasfdasfd
<p class="post-byline">by admin</p>
</div>
<div class="img_right"><a href="#"><img src="#"></a>
</div>
</li>
<li style="position: absolute; top: 0px; left: 0px; display: none; z-index: 2; opacity: 0;">
<div class="content_left">
<p class="slide-date">April 1, 2013</p>
<h2><a class="slide-title" href="#">asdfasdfasdf</a></h2>asdfasfasdfasdfasdf
<p class="post-byline">by admin</p>
</div>
<div class="img_right"><a href="#"><img src="#"></a>
</div>
</li>
<li style="position: absolute; top: 0px; left: 0px; display: none; z-index: 1; opacity: 0;">
<div class="content_left">
<p class="slide-date">April 2, 2013</p>
<h2><a class="slide-title" href="#">223234234</a></h2>asdfasfdasfasfasfasdfasdf
<p class="post-byline">by admin</p>
</div>
<div class="img_right"><a href="#"><img src="#"></a>
</div>
</li>
</ul>
<div class="feat_next"><a href="#"></a></div>
<div class="feat_prev"><a href="#"></a></div>