I have a javascript function that tries to determine if a div is visible and performs various processes with this variable. I can successfully change the visibility of elements by changing its display between none and block; but I can not save this value ...
I tried to get the value of the display attribute of the elements and find out if the element identifier is visible, but none of them worked. When I try .getAttribute, it always returns null; I am not sure why, because I know that the identifier is defined and has a display attribute.
Here is the code of two different methods I tried:
var myvar = $("#mydivID").is(":visible"); var myvar = document.getElementById("mydivID").getAttribute("display");
Any guidance or assistance is appreciated.
Devon bernard
source share