How to test if an element has been hidden or shown using jQuery?

With this example we are going to check DOM element is visible or false.

// Checks for display:[none|block], ignores visible:[true|false]
$(DOMElement).is(":visible")

var isHidden = $('DOMElement').is(':hidden');

// Matches all elements that are hidden
$('DOMElement:hidden')

// Matches all elements that are visible.
$('DOMElement:visible')

//Functions don't work with the visibility attribute.
$(DOMElement).css('display') == 'none'

//some more complete information
$(".item").each(function() {
    if ($(this).css("visibility") == "hidden") {
        // handle non visible state
    } else {
        // handle visible state
    }
});
Share this post :

Post a Comment

Please give your valuable feedback on this post. You can submit any ASP.NET article here. We will post that article in this website by your name.

 
Support : Ranga Rajesh Kumar
Copyright © 2012. ASP.NET Examples - All Rights Reserved
Site Designed by Ranga Rajesh Kumar