Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Nov 2004
    Posts
    64
    Thanks
    0
    Thanked 0 Times in 0 Posts

    check style hidden status?

    how do you check the status of a div?

    Code:
    <div id="home" style="display:none;">
    here it is not displayed or 'hidden'
    how do i check for this and also how would i manipulate it so it can be toggled
    on the fly so i won't have to reload the page?

  • #2
    Senior Coder Arbitrator's Avatar
    Join Date
    Mar 2006
    Location
    Splendora, Texas, United States of America
    Posts
    3,274
    Thanks
    28
    Thanked 271 Times in 265 Posts
    Quote Originally Posted by 6arredja View Post
    how do i check for this and also how would i manipulate it so it can be toggled
    That depends on what type of toggle you want to have (when it’s clicked, hovered, et cetera). You could do something like this:

    Code:
    if (element.style.display == "none") element.style.display == "";
    For every complex problem, there is an answer that is clear, simple, and wrong.

  • #3
    New Coder
    Join Date
    Nov 2004
    Posts
    64
    Thanks
    0
    Thanked 0 Times in 0 Posts
    if (element.style.display == "none") element.style.display == "";

    instead of element would i put:
    Code:
    document.getElementById('home').style.display
    ?

    i think i've got it now thanks arbitrator
    Last edited by 6arredja; 01-05-2007 at 02:18 AM.

  • #4
    Senior Coder Arbitrator's Avatar
    Join Date
    Mar 2006
    Location
    Splendora, Texas, United States of America
    Posts
    3,274
    Thanks
    28
    Thanked 271 Times in 265 Posts
    Assuming you want to target an element with an ID of “home”, yes.
    For every complex problem, there is an answer that is clear, simple, and wrong.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •