Yes, $(context).find(selector) is highly recommended over
$(selector,context).

It's much more understandable and it's a tiny bit faster too.

Jose, some background: When you used $(".product-right .hidden") you were
selecting *all* .product-right elements and then finding the .hidden
elements inside them.

In your mouseover callback function, 'this' holds a reference to the
specific element that received the event. That's why $(this).find('.hidden')
does what you want.

-Mike

> From: James
> 
> Or:
> 
>         $(".product-right").mouseover(function() {
>                 $(this).find(".hidden").show();
>         });
> 
> On Aug 26, 11:03 am, James <james.gp....@gmail.com> wrote:
> >         $(".product-right").mouseover(function() {
> >                 $(".hidden", this).show();
> >         });
> >
> > On Aug 26, 9:45 am, Jose <jose.bal...@gmail.com> wrote:
> >
> > > Hey everyone,
> >
> > > So I have a set of divs all with the same class name, all 
> of these 
> > > divs have a hidden div inside of them with the class name "hidden"
> >
> > > I wrote this and it seemed to work, except ALL hidden divs show 
> > > instead of the one being hovered:
> >
> > >         $(".product-right").mouseover(function() {
> > >                 $(".product-right .hidden").show();
> > >         });
> >
> > > I want only the div that is being hovered to show its hidden div, 
> > > unique IDs are sort of not a possibility so I was 
> wondering if there 
> > > was anyway to do it with jquery?
> >
> > > Thanks
> >
> > > Jose
> >
> >
> 

Reply via email to