Checking if element is visible with jQuery

0

I need to check the visibility attribute of a div .

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

How do I check and enter this if of the example?

    
asked by anonymous 04.10.2016 / 15:26

2 answers

1

You can use either:

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

as

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

or even

if($('.target').is(':visible'))
    
04.10.2016 / 15:34
0

Use the jQuery () .is function:

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