Web Tools Table Maker3schools TranslateImage CompressorFavicon Icon GeneratorCrop & Resize Image
Apu
Apu October 21, 2022 › #Element #HowTo

How to check if a div is visible in jQuery

To check whether a div is visible or not in the layout , we can simply use the JQuery :visible selector.

Example : check if a div is visible state or not. #
<script>
$(document..ready(function(){
    $("button").click(function(){
       if($("p").is(":visible")){
                alert("The paragraph  is visible.");
            } else{
                alert("The paragraph  is hidden.");
            }
    });
});
</script>
Try it Yourself »
save
listen
AI Answer
Write Your Answer
loading
back
View All