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 2 of 2

Thread: style of Div

  1. #1
    New Coder
    Join Date
    Oct 2002
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    style of Div

    I found that if I define the style(visibility...) of a Div in a CSS class, I wouldnt be able to set it through JavaScript. The only way it works is if I declare all the style attributes in the Div tag itself first. Is this how it works?
    Is there any reference on this topic that I can read about? thanks.

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    Here's an example using Javascript, even though "visible" is declared in the DIV the script overwrites it




    <div id="divID" style="visibility:visible">Hello World</div>

    <script>

    document.getElementById("divID").style.visibility="hidden"

    </script>


  •  

    Posting Permissions

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