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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:20:09+00:00 2026-05-20T10:20:09+00:00

I have 2 divs, containing three different textboxes. By default on page load I

  • 0

I have 2 divs, containing three different textboxes.

By default on page load I have enabled div1.

If I click button2 it will enable the 2nd div and disable div1.

Now I refresh the page. By default it will show the div as visible like page load.

Is there any way to show div2 and its textbox as visible using a script?

  • 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-20T10:20:10+00:00Added an answer on May 20, 2026 at 10:20 am

    If I understand you correctly, you want to be able to remember states.

    There are several options which one can use to achieve desired effect.

    1. Cookies

    On page load you can check whether a cookie has been set. If not, you will show div1 by default. If a cookie has been set, you will hide all divs except for the one that is specified by the cookie.

    In order to help yourself and save some time, you can try to find some functions for manipulating cookies with Javascript online, like this ones.

    1. Sessions

    This approach is more or less the same as with cookies, the only difference is that instead of checking whether cookies have been set, you make AJAX call for PHP script which will check whether session has been set and send a corresponding response to the Javascript using whatever format you like (ie. JSON).

    1. Local storage

    Difference between this option and the previous two is that local storage is not supported by all browsers, so you will have to check for browser support first. If user’s browser does not support local storage, you will have to use either option 1 or option 2, unless you find some more solutions to you problem.

    To check for local storage support, you can use following code:

    return ('localstorage' in window) && window['localstorage'] !== null
    

    In order to get yourself familiarized with localstorage, you can watch this short video on net.tutsplus.

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

Sidebar

Related Questions

I have a layout with a set of divs each containing three fields in
I have multiple DIVs containing an image in each. When I rollover these DIVs,
OK so what would happen if I have 2 divs (one containing text, the
I have an containing a list of divs that jQuery turns into progress bars.
I have three divs : <div id=login /> <div id=content /> <div id=menu />
I have three DIVs, something like this: <div id=header> ... </div> <div id=content> <div
I have three divs: A, B and C. A is currently visible and I
I have a slider-like widget which is basically, a div of sub-divs containing some
Here is my current situation: I have a web page containing a couple scrollable
I have a simple accordion type page containing a list of H3 headers and

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.