You could do this:
$('input.toto').each(function() {
$(this).parents('li:first').remove();
});
--Karl
____________
Karl Swedberg
www.englishrules.com
www.learningjquery.com
On Dec 15, 2008, at 9:35 AM, Just wrote:
>
> Hi John :),
> and thanks to answering.
>
> Because, as the :first is defined, it just removed the first element
> matched by $('input.toto').parents('li:first').
> Not first LI parent of each element (here each first LI parent of EACH
> input element having the class "toto").
>
> That's my problem so.
>
> I thinks that's why first-child exists too.
>
> On 12 déc, 18:40, "John Resig" <[email protected]> wrote:
>> Why not just do:
>> $('input.toto').parents('li:first').remove();
>>
>> --John
>>
>> On Fri, Dec 12, 2008 at 9:54 AM, Just <[email protected]>
>> wrote:
>>
>>> Hi,
>>
>>> Example : I have list into other list, in few LI element I've got
>>> input. I want to take all input element which have the class "toto"
>>> and remove the LI which is the parent of the input (not the direct
>>> ancestor ;)).
>>
>>> So it will be good if I could do something like:
>>> $('input.toto').parents('li:first-parent').remove();
>>
>>> What about that please ?
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---