Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9180979
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:10:48+00:00 2026-06-17T18:10:48+00:00

Using clone(rue, false).inject(‘myList’, ‘top’) reverses the item order when ‘top’is the where string. There

  • 0

Using clone(rue, false).inject(‘myList’, ‘top’) reverses the item order when ‘top’is the where string. There must be a elegant way of sorting this? is my approach wrong?

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-gb" xml:lang="en-gb">
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <script type="text/javascript" src="js/moo.1.4.5/core.js"></script>
    <script type="text/javascript">
        window.addEvent('domready', function () {


            $('myList').getChildren().each( function (el, i)  { 
                el.clone(true, false).addClass('clone').inject('myList', 'top');
                el.clone(true, false).addClass('clone').inject('myList', 'bottom');
            }) ;


        });
    </script>
</head>
<body>
    <ul id="myList">
        <li><p>Slide 1</p></li>
        <li><p>Slide 2</p></li>
        <li><p>Slide 3</p></li>
        <li><p>Slide 4</p></li>
        <li><p>Slide 5</p></li>
    </ul>
</body>
</html>

returns

<ul id="myList">
   <li class="clone"><p>Slide 3</p></li>
    <li class="clone"><p>Slide 2</p></li>
    <li class="clone"><p>Slide 1</p></li>
    <li><p>Slide 1</p></li>
    <li><p>Slide 2</p></li>
    <li><p>Slide 3</p></li>
    <li class="clone"><p>Slide 1</p></li>
    <li class="clone"><p>Slide 2</p></li>
    <li class="clone"><p>Slide 3</p></li>
</ul>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T18:10:49+00:00Added an answer on June 17, 2026 at 6:10 pm

    depends on your objective. if your aim is to clone the list and inject it at the top, you can do this along your current line of thinking:

    http://jsfiddle.net/dimitar/xNWrM/

    var list = $('myList'),
        lis = list.getElements('li');
    
    lis.reverse().each(function(el){
        el.clone(true, true).addClass('clone').inject(list, 'top');
    });
    

    there may be a more elegant way to clone them by injecting after the previously injected element as you loop them, this will save the Elements.reverse call.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A number of times I've argued that using clone() isn't such a bad practice.
I clone my source using git clone https://gerrit.wikimedia.org/r/p/mediawiki/core.git w/ . Then I specify a
So I have a Div containing an iframe that I can Clone using JQuery.
How do I loop through a clone list using jquery? <ul id=testList> <li><p> Test
Using JQuery it possible to clone a Div like this and change add a
I'm using Isapi Rewrite 3 (mod rewrite clone for IIS) and trying to rewrite
While using this code to serialize an object: public object Clone() { var serializer
I would like to clone a tag using Javascript (without using any external frameworks
I'm using the JQuery prettyPhoto lightbox clone, and it works great, but I have
I am attempting to clone fields in a form using Jquery. I'm trying to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.