On Tue, Nov 25, 2008 at 3:28 PM, Jason <[EMAIL PROTECTED]> wrote:

>
> Code:
>
> <fieldset>
> <a href="" class="link"></a>
> </fieldset>
>
> <fieldset>
> <a href="" class="link"></a>
> </fieldset>
>
> <fieldset>
> <a href="" class="link"></a>
> </fieldset>
>
> When a link is clicked, I would like to be able to reference the
> particular parent fieldset element, and not all of them.
>
> Something like this doesn't work:
>
> $('.link').click(function () {
>        $(this+':parent').BLAHBLAHBLAH();
> });
>
> Thanks in advance, the help here is top notch!


$('.link').click(function () {
$(this).parent()
});

so if you wanted to get the id of the parent <fieldset> (assuming one
existed), it'd be:

$('.link').click(function () {
alert($(this).parent().attr('id'));
});

-- 
I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.

Reply via email to