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

  • Home
  • SEARCH
  • 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 9023755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:50:14+00:00 2026-06-16T05:50:14+00:00

While the jQuery sortable widget works fine in most cases, in the case of

  • 0

While the jQuery sortable widget works fine in most cases, in the case of an ordered list, the numbering gets botched up when we drag an element. The following is a sample program to illustrate this :

<!DOCTYPE html>
<html>

    <head>
        <script src="jquery-1.6.2.min.js"></script>
        <script src="jquery-ui-1.8.16.custom.min.js"></script>
        <script>
            $(document).ready(function () {
                $('ol').sortable();
            });
        </script>
    </head>

    <body>
        <ol>
            <li>
                <label for="name">Name</label>
                <input type="text" id="name" />
            </li>
            <li>
                <label for="class">Class</label>
                <input type="text" id="class" />
            </li>
        </ol>
    </body>

</html>

Before dragging :

enter image description here

During dragging :

enter image description here

The ordering gets restored once the drag is complete. This bug has been noted before but not fixed. Has anybody found a cure for this ?

Here is the fiddle for it

  • 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-16T05:50:15+00:00Added an answer on June 16, 2026 at 5:50 am

    This is caused by the placeholder of jquery UI which is automatically added to your list when sortable start. You can actually simply hide the placeholder on start event or create your own class which has display none.

    Here the idea:

    $(document).ready(function () {
        $('ol').sortable({
            start: function( event, ui ){
                $(ui.item).parent().find('.ui-sortable-placeholder').hide();
            },
        });
    });
    

    Or:

    <script>
        $(document).ready(function () {
            $('ol').sortable({placeholder: "sortable-placeholder"});
        });
    </script>
    
    <style>
        .sortable-placeholder {display: none;}
    </style>
    

    EDIT:

    You can also actually set the placeholder display to block so that it is not assumed as a list child:

    .sortable-placeholder {
        height: 20px;
        display: block;
    }
    

    Here modified FIDDLE.

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

Sidebar

Related Questions

I have a sortable list of divs using the jquery UI. It works fine.
I am trying to use sortable, a jQuery plugin and while it works great
I have been working with jquery-ui's sortable demo for a while. On looking closely,
This should be my last question on Jquery Sortable...for a while :) I have
I am trying to develop a sortable list in Rails 3 using Jquery. I
JQuery UI Sortable works great for lists with no gaps, but say I want
I am looking for a method to have a JQuery-like sortable list ( link
I am struggling to get a list created by Ember.js sortable using jQuery.ui. The
While using jquery or javascript code most of the time i have to face
While viewing jQuery's uncompressed source code I stumbled upon something I don't quite understand.

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.