SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    Pedantic Semantic blain's Avatar
    Join Date
    Mar 2006
    Location
    Yorkshire, UK
    Posts
    528
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    style.display = 'none' not working

    I am trying to hide two divs using javascript and for some reason it's not working, is my code correct?

    the divs are ID'd blind1 and blind2, the javascript is as follows

    Code:
    <script type="text/javascript">
    var blind1 = document.getElementById('blind1');
    blind1.style.display = 'none';
    var blind2 = document.getElementById('blind2');
    blind2.style.display = 'none';
    </script>
    I'm receiving the following error in firebug

    blind1 has no properties
    blind1.style.display = "none";
    Technology is dominated by two types of people:
    those who understand what they do not manage,
    and those who manage what they do not understand.

  2. #2
    Pedantic Semantic blain's Avatar
    Join Date
    Mar 2006
    Location
    Yorkshire, UK
    Posts
    528
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I managed to solve this almost immediately after posting.

    The content is called in dynamically, and I needed to move the script position so that it was called after the dynamic content was loaded.
    Technology is dominated by two types of people:
    those who understand what they do not manage,
    and those who manage what they do not understand.


Bookmarks

Posting Permissions

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