[ACCEPTED]-How to know the status of the div in jquery?-status

Accepted answer
Score: 33

You can use is() and the :visible selector.

if( $('#test').is(':visible') ) { ... }

0

Score: 5
Score: 1

is(':visible') is, of course, correct.

In pretty much all 4 my jQuery applications, I introduce a simple 3 plugin isVisible.

$.fn.isVisible = function() {
    return $.expr.filters.visible(this[0]);
};

This is about 50 times faster than 2 the above function (jsPerf example) for exactly the same 1 functionality.

if ($('#yourElement').isVisible()) {

More Related questions