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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T15:00:30+00:00 2026-06-16T15:00:30+00:00

While there are plenty of answers regarding draggable HTML elements using jQuery, I’d like

  • 0

While there are plenty of answers regarding draggable HTML elements using jQuery, I’d like for the user to be able to specifically reorder items in a list and then have the ranking for each object (i.e. 1 for top, 3 for bottom) saved as a normal form <input>.

I began tinkering with some Javascript and looking at plenty of different resources (including this good one). However, they only detail how to move things around, not how to store the actual positions to an <input> object. Any help would be much appreciated!

IDEALLY:
<input name="item-a-ranking" type="text">
-- the javascript then determines what text is "typed in" (i.e. 1, 2, or 3) for each.
  • 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-16T15:00:31+00:00Added an answer on June 16, 2026 at 3:00 pm

    You could use the JQueryUI project, widget Sortable : http://jqueryui.com/sortable/

    There is a method called serialize to retrieve the element order.

    EDIT

    You could also use the toArray method to retrieve an array of your element. Then loop through your array to format in a specific format if you need.

    EDIT 2

    Here is an example : http://jsfiddle.net/yg4n6/7/

    $('#btn').click(function() {
        var dataItem = $("#sortable").sortable("serialize");
        alert(dataItem);
    
        $.ajax({
            url: 'save-sorting-position.php',
            data : dataItem,
            success: function(data) {                
                alert('Positions saved');
            }
        });
    });
    

    The idea is to call a php page to store the item position into your database.

    Go through the $_GET ($_POST or $_REQUEST) array to retrieve your data :

    save-sorting-position.php :

    <?php 
        $arr = unserialize($_REQUEST["item"]); 
        foreach($arr as $index => $position)
        {
            //store the position here
        }
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know there are plenty of questions regarding this error, but I haven't found
While there is plenty of documentation about XML document structure, there are very few
While there are plenty of java libraries for linear algebra, Clojure currently does not
While there are many good online and offline tools for testing regular expressions, I
While there are a handful of great programs for ISV Startups (BizSpark, Emplower ISV,
While there are many guides for Browser Helper Objects, i have a hard time
While there are multiple ways to reverse bit order in a byte, I'm curious
I can't wget while there is no path already to save. I mean, wget
I'm new at javascript and while there are many more complex solutions, I don't
I'm new to coffeescript, and while there is extensive information concerning the proper method

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.