Alternatively

$("div").click(function(){
  // all child p's
  $("p", this).show();

  // first child p
  $("p:first", this).show();

  // another way to select first child p
  $("p:eq(0)", this).show();

 // etc. Other ways to select first child... :)
});

-------------
Read jQuery HowTo Resource  -  http://jquery-howto.blogspot.com



On Wed, Jan 14, 2009 at 4:40 PM, naden <[email protected]> wrote:
>
> If there is only one <p> do $(this).children('p').show();
> if you just want to show the rirst do      $(this).children
> ('p:first').show();
>
> On 14 Jan., 02:10, Matt caron <[email protected]> wrote:
>> If I have:
>>
>> $("div").click(function(){
>>
>>      //How do I do the following
>>      $(this + " > p").show();
>>
>> });
>>
>> I want to select the child p of the div I clicked, and I know there's
>> proper syntax to it, but I am completely brainfarting on it.
>>
>> Thanks!
>> Matt

Reply via email to