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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:23:04+00:00 2026-05-26T06:23:04+00:00

sorry the issue title is kinda vague. I think i can better explain it

  • 0

sorry the issue title is kinda vague.

I think i can better explain it using the live exmaple: http://sumsy.com/temp/sorttest/

ADDED JS BIN link: http://jsbin.com/ibewar/4/edit

What I want to do it, by clicking on “move down”, it will swap the current div with the next div.

My approach is:
Set the div IDs from 0 to 3
Every time do swap/move down, its always the case that target div id = current div id + 1
after swap completes, reset the IDs again, from 0 to 3, to maintain the order.

The issue:
Try clicking “text A (move down)”, it wraps with text B no problem.
Click on “text A (move down)” again, it should swap with C, because the id for A should be 2, and C is 3.
But the problem is, A swapped with B again.

Looks like DOM is not updated/refresh after the swap?

A is the second on the list, but somehow in html markup it is still showing up as the first.

Any help would be appreciated.

Thanks.

  • 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-26T06:23:05+00:00Added an answer on May 26, 2026 at 6:23 am

    This is because the swap function is not actually re-ordering the DOM, if you notice (using firebug), it is just making the elements position relative. Therefore, you cannot rely on their position in the DOM to determine their id.

    What you should do is once the swap animation is complete, physically move the elements in the DOM. You’ll need to wipe out the positioning that was set by the swap method. To re-order the elements in the DOM, you can use the after method.

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

Sidebar

Related Questions

Sorry for the rather vague title, I couldn't think up a better description for
Sorry couldn't think of a better title. :) Here goes, I have been pulling
Sorry I couldn't think of a more descriptive title: We have an issue with
Sorry for the terribly vague title :) I am new to macros and am
Sorry for misunderstanding title, but I couldn't explained my issue in a small title.
Sorry for the waffley title. I have an issue with my iOS app. I
Sorry about the strange title, but I am having a small issue if the
So I'm sorry the title is so vague I'm not really even sure how
Sorry for the strange title, I'm not really sure how to classify this issue.
Sorry about the wierd title, feel free to come up with a better one

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.