Checking if element is visible with jQuery

Asked

Viewed 211 times

0

I need to check the attribute visibility of a div.

if ($('#divFiltros').css('visibility', 'visible').val() == true) {
    alert(true);
}
else {
    alert(false);
}

How do I check and get into this if of the example ?

2 answers

1


You can use both:

if(!$('.target').is(':hidden'))

as

if (!$('.target').css('visibility') == 'hidden'))

or even

if($('.target').is(':visible'))

0

Use function (). is of jQuery:

if ($('#divFiltros').is(":visible")) {
    alert(true);
}
else {
    alert(false);
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.