[jQuery] Re: Simple Selector Question -- Context

2008-12-04 Thread Joe

Thanks Ricardo, looks good.

On Dec 3, 10:14 am, ricardobeat <[EMAIL PROTECTED]> wrote:
> Or pError.filter(':visible').
>
> By using 'pError' as a context, you are looking for it's children, not
> the elements themselves.
>
> - ricardo
>
> On Dec 3, 1:17 pm, Liam Potter <[EMAIL PROTECTED]> wrote:
>
> > it would be this
>
> > $('p.error:visible')
>
> > Joe wrote:
> > > If I have the following:
>
> > > var pError = $('p.error');
>
> > > Then I can do the following with no problem:
>
> > > pError.text('lorem");
>
> > > Yet, I want to check for the paragraphs that have the class "error"
> > > that are visible, I would think it is something like this:
>
> > > var visibleError = $(':visible', pError);
>
> > > However, this fails.
>
> > > Is this because the visible selector is different in creating the
> > > wrapped set of paragraph tags with the class error?
>
> > > What is the proper way of using the context of pError with the visible
> > > selector?
>
> > > Thanks!


[jQuery] Re: Simple Selector Question -- Context

2008-12-04 Thread Joe

Liam,

Right, but that defeats the point of "caching" the jQuery object that
was created by:

var pError = $('p.error');

Since I'm just calling it again with a different selector, namely,
the :visible one.

On Dec 3, 9:17 am, Liam Potter <[EMAIL PROTECTED]> wrote:
> it would be this
>
> $('p.error:visible')
>
> Joe wrote:
> > If I have the following:
>
> > var pError = $('p.error');
>
> > Then I can do the following with no problem:
>
> > pError.text('lorem");
>
> > Yet, I want to check for the paragraphs that have the class "error"
> > that are visible, I would think it is something like this:
>
> > var visibleError = $(':visible', pError);
>
> > However, this fails.
>
> > Is this because the visible selector is different in creating the
> > wrapped set of paragraph tags with the class error?
>
> > What is the proper way of using the context of pError with the visible
> > selector?
>
> > Thanks!


[jQuery] Re: Simple Selector Question -- Context

2008-12-03 Thread ricardobeat

Or pError.filter(':visible').

By using 'pError' as a context, you are looking for it's children, not
the elements themselves.

- ricardo

On Dec 3, 1:17 pm, Liam Potter <[EMAIL PROTECTED]> wrote:
> it would be this
>
> $('p.error:visible')
>
> Joe wrote:
> > If I have the following:
>
> > var pError = $('p.error');
>
> > Then I can do the following with no problem:
>
> > pError.text('lorem");
>
> > Yet, I want to check for the paragraphs that have the class "error"
> > that are visible, I would think it is something like this:
>
> > var visibleError = $(':visible', pError);
>
> > However, this fails.
>
> > Is this because the visible selector is different in creating the
> > wrapped set of paragraph tags with the class error?
>
> > What is the proper way of using the context of pError with the visible
> > selector?
>
> > Thanks!


[jQuery] Re: Simple Selector Question -- Context

2008-12-03 Thread Liam Potter


it would be this

$('p.error:visible')

Joe wrote:

If I have the following:

var pError = $('p.error');

Then I can do the following with no problem:

pError.text('lorem");

Yet, I want to check for the paragraphs that have the class "error"
that are visible, I would think it is something like this:

var visibleError = $(':visible', pError);

However, this fails.

Is this because the visible selector is different in creating the
wrapped set of paragraph tags with the class error?

What is the proper way of using the context of pError with the visible
selector?

Thanks!