Here's another way:

var isVisible = $('#giftMsg').is(':visible');
var isHidden = $('#giftMsg').is(':hidden');

That reads nicely enough that dedicated functions are not needed.

- Richard

On Dec 17, 2007 12:20 PM, James Dempster <[EMAIL PROTECTED]> wrote:

>
> $('#giftMsg:visible').length == 1
>
> Will only select the element if it is visible, if it's not visible
> length will be 0 as it would have not been able to select the element.
>
> @see http://docs.jquery.com/Selectors/visible and
> http://docs.jquery.com/Selectors/hidden
>
> for more information
>
> /James
>
> On Dec 17, 5:09 pm, "[EMAIL PROTECTED]"
> <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > I'm using the toggle method to show/hide divs
> >
> > $('#giftMsg').toggle();
> >
> > But how do I check if a div is currently displayed or not?  I've
> > discovered that there is no such thing as a "shown()" or "hidden()"
> > method. - Dave
>

Reply via email to