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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T20:23:51+00:00 2026-06-06T20:23:51+00:00

I have the following html code with Jquery Sorting <div class=sortable style=’width:700px; margin: 0

  • 0

I have the following html code with Jquery Sorting

<div class="sortable" style='width:700px; margin: 0 auto; border:2px solid; border-color:grey;'>
    <a href='#' class='expand'> Group 1</a>
<ul style="display:none" class="sortable" >
    <li class="ui-state-default">Item 1</li>
    <li class="ui-state-default">Item 2</li>
    <li class="ui-state-default">Item 3</li>
</ul>

<a href='#' class='expand'> Group 2</a>
<ul style="display:none" class="sortable">
    <li class="ui-state-default">Item 4</li>
    <li class="ui-state-default">Item 5</li>
    <li class="ui-state-default">Item 6</li>
</ul>
</div> 

JQuery……

<script>
    $(function() {
        $( ".sortable" ).sortable();
        $( ".sortable" ).disableSelection();
    });
</script>
<script>
$(document).ready(function() {
    $('.expand').click(function() {
        $(this).next().toggle('slow', function() {
        });
    });
});

</script>

The list inside ul is sortable and the uls inside the div on the whole aer also sortable. The problem is when I move one item from one group to another and if I place that item in between the items of that group it is added inside ul but if i place it at the bottom of the group or just below the group then it is placed outside the ul.

Edit

Now I can sort the lists inside each ul but I cannot sort the whole ul and cannot move an item from one group to another

Can any one help me?
Thanks

On JSFiddle

  • 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-06T20:23:53+00:00Added an answer on June 6, 2026 at 8:23 pm

    Your script is going crazy because you have a bunch of items with the same id sortable – Only use one id per element, multiple elements can share the same class. Example…

    <script type="text/javascript">
        $(function() {
            $(".patents").sortable();
            $(".patents").disableSelection();
        });
    </script>
    
    <div id="sortWrap">
    
        <a href="#" class="expand">Group 1</a>
        <ul style="display: none;" id="ulOne" class="patents">
            <li class="ui-state-default">Item 1</li>
            <li class="ui-state-default">Item 2</li>
            <li class="ui-state-default">Item 3</li>
        </ul>
    
        <a href="#" class="expand">Group 2</a>
        <ul style="display: none;" id="ulTwo" class="patents">
            <li class="ui-state-default">Item 4</li>
            <li class="ui-state-default">Item 5</li>
            <li class="ui-state-default">Item 6</li>
        </ul>
    
    </div>
    

    Beside your syntax errors, what you are trying to do isn’t easily done with Sortable alone; you’ll want this extension to be able to rearrange nested lists: https://github.com/mjsarfatti/nestedSortable

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

Sidebar

Related Questions

I have the following HTML code: <script src=http://code.jquery.com/jquery-1.6.2.min.js></script> <div id=A style=width:100px; height: 100px; background:
I have the following HTML code: <div id=Activity class=rep_tb0 style=width: 100%> <div class=rep_tr0 style=width:
I have the following html code. <html> <body> <div style=max-width:1600px; min-width:900px; > <table> </table>
I have the following HTML code: <div class=member> <input type=checkbox value=64 style=display:none; name=memberId[] />
I have the following html code: <div class=outerElement> <div class=text> Lorem ipsum dolar sit
I have the following block of HTML code more than once <div id=page_1 class=page>
I have the following HTML code: <div id=summary_form> <textarea class=summary>Please fill in</textarea><br/> <textarea class=summary>Please
I have the following HTML code: <div id=scroll> <div class=foo>foo1</div> <div class=foo>foo2</div> .... <div
I have the following HTML code: <fieldset> <legend><span>Contact Details</span> <span class=edit1>Edit</span><span class=hide1>Hide</span></legend> <div> <!--content-->
I have the following HTML and jQuery code: <div id=outer> <p> <p>paragraph inside division.</p>

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.