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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T13:50:52+00:00 2026-05-21T13:50:52+00:00

I’ve searched and searched about how to do this, but to no avail. Basically

  • 0

I’ve searched and searched about how to do this, but to no avail.

Basically I have a pretty standard jQuery sortable list, using a gripper to allow users to rearrange the list

What I would like to add is an input box to each list item, autofilled with that item’s #, that allows users to enter any number (so long as it is <== the total # of items in the list)< and then hit “Enter” or press a button to re-order the list.

Please see the YouTube Playlist tool or Netflix Queue as an example of what I am referring to:
http://img195.imageshack.us/img195/7715/youtubeplaylistrearrangc.png
http://www.thedigeratilife.com/images/netflix-queue-big.jpg

I cannot figure this out – Any assistance would be greatly appreciated!

Dave

  • 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-05-21T13:50:52+00:00Added an answer on May 21, 2026 at 1:50 pm

    jsfiddle:

    http://jsfiddle.net/pMcmL/6/

    HTML:

    <ul id="sortable">
        <li class="ui-state-default">
            <span>&#x21C5;</span><input type="text"/>Item 1
        </li>
        <li class="ui-state-default">
            <span>&#x21C5;</span><input type="text"/>Item 2
        </li>
        <li class="ui-state-default">
            <span>&#x21C5;</span><input type="text"/>Item 3
        </li>
        <li class="ui-state-default">
            <span>&#x21C5;</span><input type="text"/>Item 4
        </li>
        <li class="ui-state-default">
            <span>&#x21C5;</span><input type="text"/>Item 5
        </li>
        <li class="ui-state-default">
            <span>&#x21C5;</span><input type="text"/>Item 6
        </li>
        <li class="ui-state-default">
            <span>&#x21C5;</span><input type="text"/>Item 7
        </li>
    </ul>
    

    CSS:

    http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/themes/base/jquery-ui.css

    +

    li {
        margin: 1px;
        width: 130px;
        padding:2px;
        vertical-align:middle;
    }
    
    li span {
        color: gray;
        font-size: 1.1em;
        margin-right: 5px;
        margin-left: 5px;
        cursor: pointer;
        height:100%;
    }
    
    input[type="text"] {
        width: 32px;
        margin-right: 5px;
        border: 1px solid lightgay;
        color: blue;
        text-align: center;
    }
    

    Javascript:

    sort_ul = $('#sortable');                  // * sortable <ul>
    itemsCount = $('#sortable li').length;     // * total number of items
    function updateIndexes() {                 // * function to update
        $('#sortable li input').each(          //   items numbering
          function(i) {
            $(this).val(i + 1);
        });
    }
    updateIndexes();                           // * start by update items numbering
    sort_ul.sortable({handle: 'span',          // * apply 'sortable' to <ul>
                      stop: function(event, ui){
                              updateIndexes(); // * when sorting is completed,
                            }                  //   update items numbering
    });
    $('#sortable li input').keyup(             // * watch for keyup on inputs
      function(event) {
        if (event.keyCode == '13') {           // * react only to ENTER press
            event.preventDefault();            // * stop the event here
            position = parseInt($(this).val());// * get user 'new position'
            li = $(this).parent();             // * store current <li> to move
            if (position >= 1                  // * proceed only if
                && position <= itemsCount){    //   1<=position<=number of items
              li.effect('drop', function(){    // * hide <li> with 'drop' effect
                li.detach();                   // * detach <li> from DOM
                if (position == itemsCount)
                  sort_ul.append(li);          // * if pos=last: append
                else                           //   else: insert before position-1
                  li.insertBefore($('#sortable li:eq('+(position - 1)+')'));
                updateIndexes();               // * update items numbering
                li.effect('slide');            // * apply 'slide' effect when in
              });                              //   new position
            }else{ li.effect('highlight'); }   // * if invalid position: highlight
    }}});
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have thousands of HTML files to process using Groovy/Java and I need 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.