• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

determining if element is hidden

 
Sanjiv Jivan
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a select box within a table and it has a td which is styled to be hidden. As a result, the contents of the td are also hidden. When I do an select element iteration the select elements style.visible property does not provide any info on whether the element is visible on the page or not (i'm assuming the default is inherit). Is there an easy way of determining this other than navigating thought all parents and testing the visible property?

Thanks,
Sanjiv
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do not have time to code it, but it is similiar to this: http://radio.javaranch.com/pascarello/2005/01/09/1105293729000.html

Eric
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
or this might work:



var test = getElementStyle("id", "visibility", "visibility");

Eric
 
Sanjiv Jivan
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unfortunately the above code isn't doing what I need.

elem.currentStyle evaluates to true in IE but elem.currentStyle["visible"] returns the String "inherit".

Sanjiv
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
visible is the value, not the style attribute name, it is visibility.

I still do not have time to test it, thought i would point out. If computed style does not work, than you are going to have to loop through the parents checking the visible state like I do to find the position in that link.

Eric
 
Sanjiv Jivan
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm sorry, that was a typo in my previous post. I did pass 'visibility' and not 'visible', and the function returned "inherit".

Sanjiv
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic