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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T07:40:04+00:00 2026-06-16T07:40:04+00:00

I have a site on which I use several divs with one class, which

  • 0

I have a site on which I use several divs with one class, which are displayed, and severals divs with an other class which are hidden.

I would then like to have two buttons, which I can use to toggle between which one of the two classes are displayed, with the button for the currently displayed class beeing inactive.

When the button is clicked I would like it to take effect all through the site, so the correct class is also displayed or hidden on other pages on the site.

To simplify:
So if I click button A, class A is displayed all through the site, and button B is hidden. If I then click button B, class B is displayed all through the site, and button A is hidden.

Any ideas to an easy solution for this?

  • 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-16T07:40:05+00:00Added an answer on June 16, 2026 at 7:40 am

    Since new UK legislation requires you to tell the users of the website about all cookies the website stores on their machine, I would recomend you use a session variable, you could use $_SESSION['class']="class1"; using PHP or you could use Session["class"] = "class1"; in C#, you could then check that session variable using an if statement by doing:

    if($_SESSION['class'] == "class1")
    {
        // show class 1
    }
    else
    {
        // Show class 2
    }
    

    Te above code will work in C# by replacing the $_SESSION['class'] with Session["class"] To show or hide a div, you could either do it server side by adding the different styles in problematically or you could use javascript, though I’m not sure how you’d gain access to session variables via JavaScript since they are server side. JQuery would be a good library to use for showing/hiding DIVs though.

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

Sidebar

Related Questions

I have a ticket system on my site. There are several divs which show
I have a simple site which allows users to upload files (among other things
I use overflow: hidden on my site to get control over ending floats. Which
I have an asp.net web site which will send several ExecuteNonQuery() statements (stored proc)
I have a model Messages which I use to store messages throughout the site.
We have several sites which we need to automatically redirect to another site. At
I would like to have a site.php file (similar to Python) that is automatically
I have a legacy ASP.NET site I'd like to improve a bit. One area
I have a page on a training site which displays several downloads whose ids
I have site which uses $(selector).load(path) function in more than 300 pages. Now my

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.