View Full Version : How to hide a div on a page

04-04-2009, 05:48 PM
Hello Guys,

I am using a cms and need to hide a div on certain pages was wondering how I would hide the div #sidebar for instance.

I can only seem to find the hide/show code so any help is much appreciated.

04-04-2009, 05:51 PM

Read the posting guidelines (http://codingforums.com/postguide.htm) (specifically point 3) before posting here. We need more info than “I’m using a CMS and want to hide a div”.

04-04-2009, 05:59 PM
Hello frdxon23s,
display:none; would hide it but still leave the space it takes occupied.

04-04-2009, 06:02 PM
display:none; would hide it but still leave the space it takes occupied.I think this issue is not with the display:none, but with visibility:hidden

04-04-2009, 06:09 PM
I'll be watching this thread to see. I've never had call to hide anything before, maybe I'll learn something.
More info from the OP would help, link us to the test site so we can see what your hiding.

04-04-2009, 06:17 PM
do you think it's joomla? or Drupal?

the suspense is killing me!

04-04-2009, 07:03 PM
this is how you can hide or show the sidebar, if that's the id name
you can trigger a function or something

document.getElementById("sidebar").style.visibility="hidden" ;/*hides the element*/

document.getElementById("sidebar").style.visibility="visible" ;/*shows the element*/

here's an example of using this technique. open the menu and click on the friends online section on the bottom and a little window shows up.