i needed to hide a div on my code behind:
bool hideDiv = false
//codes to change hideDiv
myDiv.visible = hideDiv;
and i want to check visibility of my div using javascript:
if (jQuery("myDiv") != null){
//some codes
}
else{
//some codes
}
and the 'jQuery("myDiv")' is always not null (even if the div was actually not visible), what is the better way to check if a div is visible?
You can use :visible
selector inside is
filtering function:
if ($('#myDiv').is(':visible'))
Notes:
#
before the id in your selector(jQuery("myDiv")
).document.getElementById
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With