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


9 Social Media and Marketing Tools Recommended for a Business

A business is set up to have a profit by delivering a product or a ...


Why hand-coding is always preferable over website builders

There is long debate as to why hand-coding is preferable over website ...


8 Reasons Your Site Should be Using Progressive Web Apps

Google has been driving at full speed since 2015 to help developers, ...


Tips to Handle Negative Feedback for Your Mobile App

Feedback from users for your mobile app is as essential as its ...


Why is Link Building So Important? Read this to understand

Getting a high ranking on search engine results is important to the ...


Productivity Tips for Web Developers for Efficient Time Management

The world is full of distractions. Whether you are a work-from-home, ...


The Importance of a Good Domain Name

The right domain name can genuinely make or break a business – ...


Cloud Strategy of Oracle: Working or Not?

Though Oracle considered cloud strategy as gibberish long before, it ...


Some Excellent SEO Tools for Boosting SEO Rankings like Never Before

You could be having a really great-looking website and the niftiest ...