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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:43:44+00:00 2026-05-28T03:43:44+00:00

I have a table with Up and Down button in all the rows and

  • 0

I have a table with Up and Down button in all the rows and i want to move rows onclick of up/down in respective directions in table. I am able to do it but the issue is i have a style sheet for alternate rows which i do not want to move along with row movement. But current function move css also which looks very wearied on the page. Can someone please let me know how can i stop moving CSS. My code is below –

$(document).ready(function(){
     $(".up,.down").click(function(){
        var row = $(this).parents("tr:first");
        if ($(this).is(".up")) {
            row.insertBefore(row.prev());
        } else {
            row.insertAfter(row.next());
        }
    });
});

I have to check if moving row has come css then it should be stripped and assigned to new row.

  • 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-28T03:43:45+00:00Added an answer on May 28, 2026 at 3:43 am

    wondering if this seem a bit acceptable

    $(document).ready(function(){
     $(".up,.down").click(function(){
        var row = $(this).parents("tr:first");
        var new_class='';
        var neigbour_class='';
        if (row.hasClass('odd')) {
           new_class='even';
           neighbour_class='odd';
        }
        else {
           new_class='odd';
           neighbour_class='even';
        }
        if ($(this).is(".up")) {
            row.insertBefore(row.prev());
            row.removeClass().addClass(new_class);
            row.prev().removeClass().addClass(neighbour_class);
        } else {
            row.insertAfter(row.next());
            row.removeClass().addClass(new_class);
            row.next().removeClass().addClass(neighbour_class);
        }
    });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table with 7M records I want to trim down to 10k
I have a table, with rows which all have a cell of a div
I am trying to have a button for selected rows of my table. Here
I have a drop down box for each row inside a table <table> <tr>
In a sorted table, it's common to have an up or a down arrow
I have table inside a div tab. The table has 40 rows in it
I have table rows of data in html being filled from a CGI application.
i have table structure with 3 colums (column1, column2, column3) and i want to
I have window with 3 table views (10.7.2, Xcode 4.2). They are all created
I have created an up/down arrow segmented control button on the right side of

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.