Q:

correct use of .is(':visible')

I have this code
<div style="height:500px;display:none"></div>
<div style="height:1000px;"></div>

<script>

$(document).ready(function() {

     var visible_elem_height = $('div').is(':visible').height()

     alert( visible_elem_height )

});

</script>

but my code Doesn't work , So what do u suggest ?

A:

.is() return a boolean value so your script will fail, instead you need
$(document).ready(function () {

    var visible_elem_height = $('div:visible').height();
    //or var visible_elem_height = $('div').filter(':visible').height()

    alert(visible_elem_height)

})

