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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T14:51:58+00:00 2026-06-10T14:51:58+00:00

I am trying to get the local storage value for the key 1 ,

  • 0

I am trying to get the local storage value for the key 1 , to be set as the value of whatever checkbox is checked, but the value returned by my javascript function appears as [object object] in local storage. Any assistance would be much appreciated, thank you in advance.

<html>

<head>

<script type="text/javascript">


function topic_1_status(){

var status = {
    get_value: function(){
         return this.value;
                    }

            };

localStorage.setItem(1, status);


}


</script>

</head>

<body>

<div>Topic no.1   </div>
<form action="">
<input type="checkbox" value="learnt" onclick="topic_1_status()" /> Learnt
<input type="checkbox" value="memorised" onclick="topic_1_status()" /> Memorised
<input type="checkbox" value="understood" onclick="topic_1_status()" /> Understood
<input type="checkbox" value="unlearned" onclick="topic_1_status()" /> Unlearned


</body>

</html>
  • 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-10T14:51:59+00:00Added an answer on June 10, 2026 at 2:51 pm

    You are getting “object object” because you are store the object ‘status’ instead of the value of the checkbox.

    This modifications should give you the results you want.

     **On the html where you call your javascript** 
     <input type="checkbox" value="learnt" onclick="topic_1_status(this);" />
     **As you can see above im passing 'this' to the function
    

    And the javascript

     //On the javascript
     function topic_1_status(elem){
         if(!elem.checked){//You may also want to check that you are checking it rather than unchecking
            var checkboxValue = elem.value;
            localStorage.setItem(1,checkboxValue);
         }
     }
    

    Also thought mentioning that it seems you want to use radio buttons instead of checkboxes as you plan to only store one item at a time.

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

Sidebar

Related Questions

I'm trying to get Symfony 2.0.14 running at my local PC but get this
I simply am trying to update local storage but inside the Ext.Ajax.request I cant
I am trying to write my own MySQL storage engine which uses a key-value
trying to get length of file which from local storage. File exists 100% (because
I am trying get all local machine services. But why are some services missing
I am trying to get local cookies (file://) to work on android 3.1+ within
I'm trying to get my local dev django app to work after following these
I'm trying to get the local IP address of my Android device using Mono
I am trying to get a list of local network computers. I tried to
I am trying to get all Books from the server (local PHP script), that

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.