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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:00:34+00:00 2026-05-26T02:00:34+00:00

I do a localStorage.setItem(‘oldData’, $i(textbox).value); to set the value of key oldData to the

  • 0

I do a

localStorage.setItem('oldData', $i("textbox").value);

to set the value of key oldData to the value in a textbox.

The next time something is entered to the textbox, I want to append to the already existing oldData.

So, if I enter apples and then oranges in my textbox, my localStorage key oldData should look like this:

Initially:

Key      |   Value
---------------------------
oldData  |  apples

Now:

oldData  |  apples oranges

How can I append? Is there an append method provided?

Or do I need to read the data first, append in javascript and then write back?

  • 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-26T02:00:35+00:00Added an answer on May 26, 2026 at 2:00 am

    There’s no append function. It’s not hard to write one though:

    function appendToStorage(name, data){
        var old = localStorage.getItem(name);
        if(old === null) old = "";
        localStorage.setItem(name, old + data);
    }
    
    appendToStorage('oldData', $i("textbox").value);
    

    Note: It makes more sense to define a function append on the localStorage object. However, because localStorage has a setter, this is not possible. If you were trying to define a function using localStorage.append = ..., the localStorage object will interpret this attempt as “Save an object called append in the Storage object”.

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

Sidebar

Related Questions

I'm trying to extend localStorage w/ the following... localStorage.prototype.setItem2 = function(key,value) { localStorage.setItem(key,value); }
I have the following localStorage key: localStorage.setItem(1, <div id='MyId'>value 1</div><div id='NewId'>other value</div>); Is it
I noticed that I cannot set boolean values in localStorage ? localStorage.setItem(item1, true); alert(localStorage.getItem(item1)
I've been playing around with HTML5 local storage, using localStorage.getItem(something) and localStorage.setItem(something,somevalue) and it's
With JavaScript/HTML5's LocalStorage feature, if you're on myDomain.com:81 and you set a value in
I am using this code inside a jQuery plugin: setInterval(function() { localStorage.setItem(flag, set); var
window.localStorage.setItem(Georgia,Atlanta) var x=window.localStorage.getItem(Georgia) I have a list of 50 states and the largest city
How can I check if an item is set in localStorage ? Currently I
When you use Html5 localStorage values are stored as strings. This is something you
I made a simple function localStorage.setItem('foo', 'bar') alert(localStorage.getItem('foo')); If I run it like this

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.