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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:28:55+00:00 2026-06-01T20:28:55+00:00

I have the following: $(document).ready(function () { var store = window.localStorage; $(‘#accounts > li

  • 0

I have the following:

$(document).ready(function () {
   var store = window.localStorage;
   $('#accounts > li > a').click(function (e) {
                var store = window.localStorage;
                e.preventDefault();
                store.setItem('account1', $(this).html());
                alert($(this).html());
                alert(store.getItem('account1'));
   });
   ...

When I make a change to the link the first alert gives me the correct value but the last alert just gives me null. I’m using Firefox 11 (very latest) and IE 9. I thought both would allow local storage.

Can anyone see what I am doing wrong. It seems very simple code. I just cannot get items to store.

Here’s the HTML I am using:

<div style="margin-top: 20px;" class="btn-group">
    <label style="background: none; background-color: #333; width: 120px;" 
    class="btn btn-inverse" id="account">X</label>

    <button data-toggle="dropdown" class="btn btn-inverse dropdown-toggle">
    <span class="caret"></span>

    </button>
    <ul class="dropdown-menu" id="accounts">
    <li><a data-value="00" href="#">A</a></li>
    <li><a data-value="01" href="#">B</a></li>

    <li><a data-value="02" href="#">C</a></li>
    <li><a data-value="16" href="#">D</a></li>
    </ul>
</div>
  • 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-06-01T20:28:56+00:00Added an answer on June 1, 2026 at 8:28 pm

    I copied your code exactly as you have it above and put it on jsfiddle. I had to improvise the HTML, since you didn’t post it, but it works for me on Chrome, Safari and IE9.

    I would suggest posting your HTML. That may be the problem.

    Does this demo work for you?:

    http://jsfiddle.net/ThinkingStiff/MRLEW/

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

Sidebar

Related Questions

I have the following JQuery code: $(document).ready(function () { var $containerHeight = $(window).height(); if
I have the following jquery code. var destTable = $(#numbers); $(document).ready(function() { $(#btnAdd).click(function() {
I have the following: $(document).ready(function() { var myIframe = document.getElementById('myIframe'); var element = myIframe.contentDocument.createElement('script');
I have the following code: $(document).ready(function() { var id = 'cbx'; var idPrefix =
I have the following: somefile.php $(document).ready(function() { var handler = function(data) { var JsDiv
I have the following JQuery code: <script type=text/javascript> $(document).ready(function () { var $containerHeight =
I have the following code $(document).ready(function() { $('a#slick-toggle').click(function() { $('#slickbox0').toggle(400); return false; }); });
I have the following code: $(document).ready(function() { $('.container').ready(function() { var v = new Video($(this));
I have the following function: $(document).ready(function() { $('#p').click(function() { $('#s1').hide(); gameStart(); <-starts timer $('#s2').show();
I have the following JQuery: $(document).ready(function() { var names = ['item1', 'item2']; var series1

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.