SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Jun 2010
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    A quick javascript question on hidden HTML elements

    I have a javascript function on my HTML page that periodically assigns content to a DIV. This I am doing with a timer (setTimeout).

    If under certain circumstances, display of the DIV is set to 'none' or the visibility is set to 'hidden', how does Javascript handle it?

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,869
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    The element is still in the HTML and so JavaScript can update it. That the CSS hides it from being displayed makes no difference.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    SitePoint Member
    Join Date
    Jun 2010
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I should probably figure out a way (test for the display status of the DIV) to not invoke the JS when the DIV is hidden. Thank you for your help.

  4. #4
    SitePoint Member Ricechen's Avatar
    Join Date
    May 2010
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Set the div can solve your problem, no need to use js


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
  •