I have a javascript function that tries to determine whether a div is visible and does various processes with that variable. I am successfully able to swap an elements visibility by changing it's display between none and block; but I cannot store this value...
I have tried getting the elements display attribute value and finding if the the element ID is visible but neither has worked. When I try .getAttribute it always returns null; I am not sure why because I know that id is defined and it has a display attribute.
Here is the code of the two different methods I have tried:
var myvar = $("#mydivID").is(":visible");
var myvar = document.getElementById("mydivID").getAttribute("display");
Any guidance or assistance would be greatly appreciated.
display
is a member of thestyle
property, not an attribute. – Dickdickenvisibility: hidden
counts too? – Uria$("#mydivID").is(":visible");
not working? – SenlacI have tried getting the elements display attribute
- I guess it doesn't return the display value. – Reedyis(':visible')
works just fine, so the problem lies elsewhere, and moving on to something else that basically does the exact same thing probably won't help much. – Sylphiddisplay
value? Or whether the element is visible? There's a lot more to finding out if the element is actually visible than just looking at its styledisplay
property – Senlac