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 8876829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:18:41+00:00 2026-06-14T19:18:41+00:00

Here’s my problem. I want a script that takes the first ten items from

  • 0

Here’s my problem. I want a script that takes the first ten items from an <ul> list and moves them into list1, then takes the next ten and moves them to the second one, and the same for the third one.
I tried to do that using jQuery.each() but it won’t work.

<html>
<body>
    <ul class="list">
        <li>1</li>
        <li>2</li>
        <li>3</li>
    </ul>
    <ul class="list1"></ul>
    <ul class="list2"></ul>
    <ul class="list3"></ul>
</body>
</html>

Here is some javascript. It is a fixed working one.

function SortCats(ul){
var array = [];
//var lis = $("#CatNavi li");
//for (var i = 0; lis.length; i++){
//  array.push(lis[i].html());
//  lis[i].hide();
//}
var $altlis = $("#CatNavi li");

var $cat1 = $(".supercat1");
var $cat2 = $(".supercat2");
var $cat3 = $(".supercat3");

$altlis.each(function(index){
alert("Shit happens");
    if (index < 10){
        $cat1.append($(this));
        alert("Shit happens");
    }
    else if (20 >= index > 10){
        $cat2.append($(this));
    }
    else if (index > 20){
        $cat3.append($(this));
    }
});
}
  • 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-14T19:18:42+00:00Added an answer on June 14, 2026 at 7:18 pm

    You want to move first ten items of the main list (with class list) to the other list with class list1 the following ten to the list with class list2 and so on?

    I propose such solution :

    $("ul.list li").each(function(i) {
       var iList = Math.floor(i / 10) + 1;
       $("ul.list" + iList).append($("<li>" + $(this).html() + "</li>"));
    })
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's the code I have. It works. The only problem is that the first
Here is the script I'm using, copied directly from Google: <script type=text/javascript> var _gaq
Here is the problem that I am trying to solve. I have two folders
Here's a problem I ran into recently. I have attributes strings of the form
Here's a coding problem for those that like this kind of thing. Let's see
Here's the code I'm running. Basically I scrape data, and place them into simple
Here is another spoj problem that asks how to find the number of distinct
Here is a simple function which i made on PHP. The problem is that
Here's the SQL query Select sum(f.Acres*m.credit1), sum(f.Acres*m.credit2), sum(f.Acres*m.credit3) from first f join model m
Here's my code in the <head></head> : <link rel=stylesheet href=http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.css /> <script type=text/javascript src=http://code.jquery.com/jquery-1.7.1.min.js></script>

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.