On Thu, Aug 6, 2009 at 8:19 AM, Joshua Beall <joshbe...@gmail.com> wrote:

>
> On Aug 5, 7:05 am, "Richard D. Worth" <rdwo...@gmail.com> wrote:
> > Your question is better suited to the main jQuery list:
> http://groups.google.com/group/jquery-en
> >
> > <http://groups.google.com/group/jquery-en>since it's not about jQuery UI
> > plugins[*].
>
> I was thinking that because my use case is most directly tied to the
> blind effect (part of jQuery UI, as I understand it), this would be
> the best list.  Sorry for the confusion.
>
> > While we're here, you can use the visibility pseudo-selectors, :hidden
> and
> > :visible
> >
> > http://docs.jquery.com/Selectors/hidden
> >
> > http://docs.jquery.com/Selectors/visible
>
> Thanks!  But I'm not sure how I'd use these selectors to interrogate
> an element by ID--it appears they are used to return elements that are
> hidden or visible, respectively.  But I already know an element's ID,
> and I want to know if it's hidden or visible... how would I do that
> with those selectors?


You can include the pseudo-selector in the same selector, immediately after
the ID, like so:

$("#myDiv:hidden").show();
$("#myDiv:visible").hide();

Another option would be to use the filter method:

$("#myDiv").filter(":hidden").show();
$("#myDiv").filter(":visible").hide();

- Richard

Reply via email to