国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Is there any way in jquery to copy myself and all child elements.
習(xí)慣沉默
習(xí)慣沉默 2017-06-05 11:12:54
0
6
918
<ul class="swiper-wrapper">
    <li class="swiper-slide">
        <img src="./images/banner-1.jpg" alt="">
        <span class="slider-text"></span>
    </li>
    <li class="swiper-slide">
        <img src="./images/banner-2.jpg" alt="">
        <span class="slider-text"></span>
    </li>
    <li class="swiper-slide">
        <img src="./images/banner-3.jpg" alt="">
        <span class="slider-text"></span>
    </li>
    <li class="swiper-slide">
        <img src="./images/banner-4.jpg" alt="">
        <span class="slider-text"></span>
    </li>
</ul>

I want to copy the li tag itself including all sub-elements to the front of the first li tag. jquery has a simple way to write it.

var swiperPic = $(".swiper-slide")
var liHtml = swiperPic.eq(swiperPic.length - 1).html()
swiperPic.eq(0).before("<li class="swiper-slide">" +  liHtml +"<li>")

What I think of is to copy all the child elements under the li tag but not the li tag itself.

習(xí)慣沉默
習(xí)慣沉默

reply all(6)
小葫蘆

Try.clone().find(">*")

小葫蘆

$(selector).children(selector) is used to return the child elements of each element in the matching element set.

滿天的星座

Can’t just clone the whole thing$('.swiper-slide')

給我你的懷抱
var swiperPic = $(".swiper-slide");
swiperPic.eq(0).before(wiperPic.eq(swiperPic.length - 1).children().clone());
劉奇

For native js, just use element.cloneNode(true)

左手右手慢動作

.clone

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template