[jQuery] Re: Remove DOM siblings after current item

2007-06-05 Thread Mario Moura

Not tested

$().remove($('#appendExtraAppointments').children());

or


$().remove($('#appendExtraAppointments').siblings());

Not sure,

Mario

2007/6/5, [EMAIL PROTECTED] [EMAIL PROTECTED]:



I have the following DOM:

ul
liblah 1/li
li id=appendExtraAppointmentsblah 2/li
liblah 3/li
liblah 4/li
/ul

I would like to remove the li elements after the li
id=appendExtraAppointmentsblah 2/li.

I tried doing something like this, but it didn't work:

$('#appendExtraAppointments').siblings().not($('li').prev).remove();

Any ideas?

Thanks!





--
Mário Alberto Chaves Moura
[EMAIL PROTECTED]
31-9157-6000


[jQuery] Re: Remove DOM siblings after current item

2007-06-05 Thread Emil Ivanov

var next = $('#appendExtraAppointments').next('li');
while (next.size() != 0) {
next = $('#spc').next('li');
next.remove();
}

Regards,
Emil Ivanov

On Jun 5, 5:02 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 I have the following DOM:

 ul
 liblah 1/li
 li id=appendExtraAppointmentsblah 2/li
 liblah 3/li
 liblah 4/li
 /ul

 I would like to remove the li elements after the li
 id=appendExtraAppointmentsblah 2/li.

 I tried doing something like this, but it didn't work:

 $('#appendExtraAppointments').siblings().not($('li').prev).remove();

 Any ideas?

 Thanks!



[jQuery] Re: Remove DOM siblings after current item

2007-06-05 Thread Brandon Aaron

All you need is general sibling combinator like this:

$('#appendExtraAppointments ~ li').remove();

More info on the selector.
http://www.w3.org/TR/2005/WD-css3-selectors-20051215/#general-sibling-combinators
http://docs.jquery.com/DOM/Traversing/Selectors

--
Brandon Aaron

On 6/5/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:



I have the following DOM:

ul
liblah 1/li
li id=appendExtraAppointmentsblah 2/li
liblah 3/li
liblah 4/li
/ul

I would like to remove the li elements after the li
id=appendExtraAppointmentsblah 2/li.

I tried doing something like this, but it didn't work:

$('#appendExtraAppointments').siblings().not($('li').prev).remove();

Any ideas?

Thanks!