How do i test if something is hidden with jQuery?

Possible Duplicate:
Testing if something is hidden with jQuery

In jQuery, suppose you have an element of some kind that you're hiding and showing, using .hide() , .show() or .toggle() . How do you test to see if that element is currently hidden or visible on the screen?


Try

$("some-selector").is(':hidden');

or

$("some-selector").is(':visible');  

Here are the docs for the :visible and the :hidden selectors.


$('.target').is(':hidden') // returns true if the element is hidden
$('.target').is(':visible') // returns true if the element is visible
链接地址: http://www.djcxy.com/p/2388.html

上一篇: JQuery:如果div可见

下一篇: 如何测试jQuery隐藏的内容?