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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T14:29:57+00:00 2026-06-01T14:29:57+00:00

Possible Duplicate: HTML5 local storage sort I am storing data into a localstorage using

  • 0

Possible Duplicate:
HTML5 local storage sort

I am storing data into a localstorage using HTML5
I need to have it sort in the order I put them in.
Originally, I had them start with Q: and then appended data to it.
I found out taht when I retrieved the data, it did not come out in the same order I entered them in.
I then did someting like 1Q:.., 2Q:.. + ..

but found that it again did not sort in the order I needed them in.

      localStorage.getItem(... )

Wondering how I can tell it what sort order to retrieve the data in?

I have the key as such:

1Q:fdf
2Q:dfdf
3Q:dfdf

For the value is is random values.
I as hoping that having the key in a certain order may make it work.

  • 1 1 Answer
  • 1 View
  • 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-01T14:29:58+00:00Added an answer on June 1, 2026 at 2:29 pm

    localStorage is a pure key-value store. it doesn’t care for orders or anything other than its key-value pairs, which are always stringified.

    if you want to do something fancier you might want to use indexed db which belongs to the html5 standard now (or the web sql database which is implemented in some browsers, but was abandoned some time ago) or pass an stringified object which could contain more info, like the value and a possible sort-order.

    how exactly did you pass the data to localstorage?

    EDIT to your answer to my question:

    you could create an array, containing your sorted values and store it’s stringified representation. You might need to write your own sort-function for that.

    localStorage.setItem(JSON.stringify( <your sorted array> ));
    

    then, to retrieve the value, you can do:

    var array = JSON.parse( localStorage.getItem( <your sorted array> ) );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: <nav> or <menu> (HTML5) HTML have two semantic tags for create a
Possible Duplicate: Should i be using HTML5 and CSS3? How do you decide if
Possible Duplicate: Problem calling a Local HTML File from XCode I am using the
Possible Duplicate: Adding HTML entities using CSS content I have the following setup CSS:
Possible Duplicate: Best way to use html5 data attributes with rails content_tag helper? How
Possible Duplicate: mail() header problem for html email I'm using the following for $headers
Possible Duplicate: HTML Compress File Upload? I have complains from client that my website
Possible Duplicate: Convert HTML to PDF in .NET I am using VSTS 2008 +
Possible Duplicate: javascript WYSIWYG HTML editors? Im not quite sure how to put this
Possible Duplicate: PHP server on local machine? Is it possible to run .php files

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.