Sounds like you only want the 'pointer' class and click handler to be
applied to the first 'p'? Maybe something like this (untested):

$('#texto>ol>li>p+*').hide();
$('#texto>ol>li>p:eq(0)').addClass('pointer').click(function(){
     $(this).siblings().toggle();
});

See: http://docs.jquery.com/Traversing/siblings#expr

Hope it helps (and works).

--Erik


On 10/24/07, linsms <[EMAIL PROTECTED]> wrote:
>
>
> Hi,
> I want to make a really simply thing: hide and show "p" elements in a
> list clicking in the first "p"
> I have this code in document.ready function:
>
>         $('#texto>ol>li>p+*').hide();
>         $('#texto>ol>li>p').addClass('pointer');
>         $('#texto>ol>li>p').click(function(){
>                 $('this+*').toggle(); <- this is not working
>                 });
>
> I've try $('+*',this).toggle(); but it only matches the first element
> after this and I want to match all elements in list after this element
> (all brothers)
>
> Any ideas?
> Thanks
>
>

Reply via email to