On Aug 6, 8:26 am, "Richard D. Worth" <rdwo...@gmail.com> wrote:
> 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();
>


That works--I had assumed that if I called something like $
("#myDiv:hidden").show(); when myDiv is visible, it would cause a
problem "object not found" problem since #myDiv:hidden" should return
nothing, and I then tried to call ".show()" on that "nothing" that was
returned.

In Java/C# I would get a NullReferenceException if I tried something
like this.  That's where I do most of my development so that's what I
was expecting.

But I am left asking, why *don't* I get some kind of "object not
found" error?

  -Josh

Reply via email to