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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:31:26+00:00 2026-05-24T17:31:26+00:00

Say I have this html: <table> <tr> <th>Sort Order</th> <th>Name</th> </tr> <tr class=item id=item_1>

  • 0

Say I have this html:

<table>
  <tr>
    <th>Sort Order</th>
    <th>Name</th>
  </tr>

  <tr class="item" id="item_1">
    <td class="sortorder">1</td>
    <td>ABC</td>
  </tr>

  <tr class="item" id="item_2">
    <td class="sortorder">2</td>
    <td>DEF</td>
  </tr>

  <tr class="item" id="item_3">
    <td class="sortorder">3</td>
    <td>XYZ</td>
  </tr>
</table>

What I want is for a user to be able to sort the rows in the table (excluding the first row with the <th>s, so all rows with the class .item) by dragging and dropping them, and then update their sort orders.

E.g if user drags DEF to first position and ABC replaces it, I want DEF’s sort order to say 1, and ABC’s to say 2 instead.

How can this be done?

If needed, I can have all the items stored seperately in a javascript array or object so I can loop over them and update each item’s sort order whenever the user changes the sort order.

  • 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-24T17:31:27+00:00Added an answer on May 24, 2026 at 5:31 pm

    You can use jQuery UI’s sortable list. Its well supported across browsers and has many options and callbacks. They use a list in their example but you could just as easily use a table.

    jQuery UI Sortable Documentation – http://jqueryui.com/demos/sortable/
    Sortable tutorial/guide – http://www.petefreitag.com/item/736.cfm

    Example:

    $('table').sortable({
        items : '.item',
        update : function(event, ui)
        {
            alert('sort order updated');
    
            // Display sort order - also checkout serialize() method in jQuery UI Docs
            alert('sort order: ' + $(this).sortable('toArray').toString());
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I have jquery code like this: html += '<div class=index>' + item.index +
Say I have this <table border=1 id=tbl> <tr> <td><input type=checkbox name=vehicle value=Bike /></td> <td>row
let's say I have this set of HTML-markup and CSS #CSS .inputhelp_text { background:
Take a very simple case as an example, say I have this URL: http://www.example.com/65167.html
Let's say I have some code like this: <html> <head><title>Title</title></head> <body> <?php if (!$someCondition){
Lets say have this immutable record type: public class Record { public Record(int x,
Say I have this simple form: class ContactForm(forms.Form): first_name = forms.CharField(required=True) last_name = forms.CharField(required=True)
say I have this $result = mysql_query('SELECT views FROM post ORDER BY views ASC');
Let's say I have a test.html file with some example content: <table> <tr> <td>'Test'</td>
Let's say we have the following html syntax: <TABLE width=400, height=300> <TR> <TD color=Red>SOME

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.