Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to check a div is visible or not in jquery?
Sponsered Link
#1
How do I check if an element is hidden in jQuery?

Today I going to share variouse ways to test or check whether a HTML element is hidden or visible in Jquery. The Jquery is very powerful JavaScript library. It has various ways to hide an element. Here are the ways to test if an element is hidden or not.

1- $(element).is(":visible");
2- if ($(element).css("visibility") == "hidden") {
// element is hidden
}
3- if ( $(element).css('display') == 'none' ){
// element is hidden
}

This is helpful in some cases and useless in others, as if you would like to verify if the element is visible (display != none), ignoring the parents visibility, you will come across that doing .css("display") == 'none' is not only faster, but it returns the visibility check correctly.
Reply


Messages In This Thread
How to check a div is visible or not in jquery? - Kelly - 03-28-2018, 04:36 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)