How to Check the Visibility of an Element Using jQuery?

In the  jQuery versions before 1.3.2  an element was regarded as Visible if the CSS Visibility Property of that element was not defined as “Hidden” or if the CSS Display Property of that was defined as  “Visible “ or  it was an element with an input type not equal to “Hidden”. There are several options available to test whether an element is hidden or visible with jQuery. Nowadays with the later versions of jQuery the visibility of an element is determined by taking into consideration the height and width of the element. The element is considered to be visible if the height or width of the element is greater than zero otherwise the element is considered as Hidden.

a) We can make use of a Pure Selector to find out the visibility of an element and this method is considered to render the best performance than other methods. Below is the sample code listed for the same:

if ($('element_name:visible').length > 0){

alert(‘Element is Visible (Verified Using a Pure Selector)!’);


b) Using the is() Method of jQuery

if ($('element_name').is(':visible')) {

alert(‘Element is Visible (Verified Using is() Method)!’);


c) Using the filter() Method of jQuery

if ($('element_name').filter(':visible'). length >0) {

alert(‘Element is Visible (Verified Using filter() Method)!’);



Recently Published


8 Search Form Tutorials Built With CSS3, jQuery & HTML5

Elevate the power of search by adding search functionality or search ...


10 Best HTML5 Frameworks For Hybrid App Development

Hybrid apps are generally built around native web view container or ...


A Look at The Evolution Of WordPress and What Future Holds For It

When it comes to developing a website, WordPress is the first name ...


7 WordPress Plugins That Make Your Site Mobile Responsive

Not much in the recent past, having a responsive website that works ...


Things you should Consider When You Are Designing an E-commerce Website

The people of today’s generation have discovered the various ...


Developing a Mobile App Using Open Source Software? Consider These Tips For Security

Today, almost every IT organization (including the Fortune 500 ...


5 CSS Tools You Shouldn’t Miss As a Web Designer and Developer

It’s no secret that CSS (Cascading Style Sheets) is the key to ...


10 Awesome Live Chat Plugins for WordPress

Patronage by loyal customers yields 65 percent of a typical ...


10 High-Grade Premium Drupal Themes Worth A Quick Install

Serving as the perfect tools for enhancing your Drupal ...