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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T05:49:57+00:00 2026-06-08T05:49:57+00:00

My web page is like the following: <div id=id1 class=stuff> TEXT, FORMS, and STUFF

  • 0

My web page is like the following:

<div id="id1" class="stuff">
TEXT, FORMS, and STUFF
</div>

<div id="id2" class="stuff" style="display:none">
TEXT, FORMS, and STUFF
</div>

<div id="id3" class="stuff" style="display:none">
TEXT, FORMS, and STUFF
</div>

<a id="btn1">DD</a>
<a id="btn2">DD</a>
<a id="btn3">DD</a>

Under this I have jQuery click events which set the display of the clicked item to inherit and the others to none.

$("#btn2").click(function (e) {
    $("#id1").css('display','none');
    $("#id3").css('display','none');
    $("#id2").css('display','inherit');
});

The showing and hiding works correctly however I do notice that some things in the initially hidden divs do not render correctly, especially the elements that get manipulated by CSS. Essentially when the page loads the hidden divs do not correctly get rendered and when they are shown things look ugly. What is the way to properly do this?

EDIT::::::::::::::::::::::::::::::::::::::::::::::

What I ended up doing is setting all of the initially hidden divs to “visibility: none”, then in the pages onLoad() event setting the display: none. When I toggle I change both the visibility and display. Everything renders correctly and because things are statically set to not visible there is no ugly 2 seconds where all the divs show.

  • 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-08T05:50:00+00:00Added an answer on June 8, 2026 at 5:50 am

    Try using visibility instead. Example:

    $("#id2").click(function (e) {
        $("#id1").css('visibility','hidden');
        $("#id3").css('visibility','hidden');
        $("#id2").css('visibility','visible');
    });
    

    Both display and visibility can have an effect on browser behavior.

    An alternative work-around to both is to set the opacity of the divs you want to hide to 0. That always works in my experience but is less elegant.


    Update in reply to comment: In that case, you can set other properties like the width and height to 0px and the over-flow to hidden so that the divs don’t occupy any space on screen. Ugly, but basic, and works.

    <style>
    .hidden {
        visibility: hidden;
        overflow: hidden;
        width: 0px;
        height: 0px;
    }
    </style>
    
    <div class="hidden"><img src="http://upload.wikimedia.org/wikipedia/commons/thumb/f/fd/Aster_Tataricus.JPG/245px-Aster_Tataricus.JPG"/></div>
    <div class="hidden"><img src="http://upload.wikimedia.org/wikipedia/commons/thumb/a/a7/Chamomile%40original_size.jpg/280px-Chamomile%40original_size.jpg"/></div>
    <div><img src="http://upload.wikimedia.org/wikipedia/commons/thumb/a/a7/Jonquil_flowers06.jpg/320px-Jonquil_flowers06.jpg"/></div>
    

    You can use the jQuery addClass and removeClass methods to make the divs visible and invisible, e.g.: $("#id1").removeClass("hidden"); and $("#id3").addClass("hidden");.

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

Sidebar

Related Questions

Lets say i have the following web page: <html> <body> <div class="transform"> <span>1</span> </div>
I have an image on my web page like this: <img src=/Images/content/home.png alt= style=float:
I am trying the following: public partial class PopUps : System.Web.UI.Page { public string
I have the following HTML code: <div id=Activity class=rep_tb0 style=width: 100%> <div class=rep_tr0 style=width:
Say I have a web page like this on an Ubuntu 12.04 web server
This is how my web page looks like: PosisionDataView is a web user control,
I'm reading a web page using HttpClient like this: httpclient = new DefaultHttpClient(); httpget
Im making an 'app like' web page. The actual page is wider than the
I have been working on a web page and would like to load multiple
I'd like my web page to allow the user to add data, even when

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.