Sure, use $('p',this) where you have $(this.'p').

Once you get it working, though, you may find yourself in a situation where
paragraphs get hidden and shown rather unexpectedly. Suppose you have one of
your paragraphs expanded and you now move the mouse over the next heading
below that. What order will things happen in now? It may happen that the
original paragraph gets collapsed first, which means the mouse may now be
over a *different* heading than the one it was over after you moved it.
Which one will be expanded? Maybe the one you want, maybe not.

You may want to try the hoverintent plugin to help avoid this. I'm not
saying it's a silver bullet, but it may do better than the raw hover method.

-Mike

> I'm wondering if there is such a thing as:
> 
> $("div").hover(
>       function(){
>               $(this."p").show();
>       },
>       function(){
>               $(this."p").hide();
>       }
> );
> 
> I know the above code is useless because of the use of "this" 
> but I wonder if there's a selector that does this?
> 
> the objective would be to show/hide the paragraph inside the 
> div which is being hovered
> 
> <div>
>       <h1></h1>
>       <p></p>
> </div>
> <div>
>       <h1></h1>
>       <p></p>
> </div>
> <div>
>       <h1></h1>
>       <p></p>
> </div>
> ...

Reply via email to