Tuesday 27 December 2011

How to find if something is hidden in jQuery?

How do you test to see if that element is currently hidden or visible on the screen?

You can use the "hidden" and "visible" selectors.
$(element:hidden;
$(element:visible); 


$(element).is(":visible") // Checks for display:[none|block],

$(".list").each(function()
{
    if ($(this).css("visibility") == "hidden")
    {
        // handle non visible state
    }
    else
    {
        // handle visible state
    }
})

No comments:

Post a Comment