Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
90
rated 0 times [  94] [ 4]  / answers: 1 / hits: 20572  / 14 Years ago, tue, april 13, 2010, 12:00:00

I have an input text field which has



style: visibility: visible


or



style: visibility: hidden


What is the easiest way to find out if it is visible or not ?



Suppose the input text field is E. What should be the condition here:



if <something with E> {
alert(The text filed is visible !!);
}


?



Thanks in advance !


More From » javascript

 Answers
58

Like this:



if(element.style.visibility == visible) {
alert(The text filed is visible !!);
}


If you also need code to get the element, here's an example by the id attribute:



var element = document.getElementById(myInputID);
if(element.style.visibility == visible) {
alert(The text filed is visible !!);
}


The above code would find an element like this (note IDs should be unique):



<input type=text id=myInputID />

[#97083] Sunday, April 11, 2010, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jazminkyrap

Total Points: 631
Total Questions: 89
Total Answers: 109

Location: Finland
Member since Fri, Oct 21, 2022
2 Years ago
;