They're basically equivalent, though not quite identical. The first creates
a jQuery object containing 'this' and calls the find method on it, finding
elements that match the selector. The second searches for elements that
match the selector, within a non-default context provided (the default
context is the document). So what's the difference? None in terms of finding
the elements that match this selector within this element. But imagine you
wanted to chain and do more with $(this). After .find(selector).hide() you
could .end() and go along with your chain (which is now back at $(this)). In
short, use whichever one works.

- Richard

On Mon, Jan 5, 2009 at 9:55 PM, MorningZ <morni...@gmail.com> wrote:

>
> Richard
>
> Is either of those those methods "recommended" over the other?
>
> I always wondered if those two are basically equivalent
>
>
>
>
> On Jan 5, 8:50 pm, "Richard D. Worth" <rdwo...@gmail.com> wrote:
> > Either of these should work
> >
> > var selector = ".pNumber, .pCondition, .pPictureStrip, .pNotes,
> .pLocation";
> >
> > $(this).find(selector).hide();
> >
> > $(selector, this).hide();
> >
> > - Richard
> >
> > On Mon, Jan 5, 2009 at 7:22 PM, EricC <dt.e...@gmail.com> wrote:
> >
> > > I am not sure if I am going about this is the best way but I have a
> > > div with 8 divs inside of it. 2 always show and I would like the other
> > > 6 to come on only when the parent div is rolled over. Here is what I a
> > > have so far:
> >
> > > $(function() {
> > >        /* hide items to be shown only when hovered over */
> > >
>  $('.pNumber,.pCondition,.pPictureStrip,.pNotes,.pLocation').hide();
> >
> > >        $('.pWrapper').hover(
> > >        function() {
> > >        $(this).show
> > > ('.pNumber,.pCondition,.pPictureStrip,.pNotes,.pLocation');},
> > >        function() {
> > >        $(this).hide
> > > ('.pNumber,.pCondition,.pPictureStrip,.pNotes,.pLocation');
> > >        });
> >
> > > });
> >
> > > the syntax is wrong but this is the idea. Also there are more than one
> > > pWrapper on each page. I have found a solution that will turn them ALL
> > > on or off, but I need to only have the items inside the pWrapper that
> > > is being rolled over effected. Any help would be appreciated.
> >
> > > Cheers,
> >
> > > Eric
>

Reply via email to