Removing children elements given an index?

后端 未结 3 1154
刺人心
刺人心 2020-12-30 03:29

I\'ve got a layout like this:

3条回答
  •  暖寄归人
    2020-12-30 03:59

    This is an old thread, but I'm curious* why nobody mentioned nth-child.

    $("#parent > div:nth-child(n + " + index + ")").remove();
    

    *Update: I didn't have enough rep to know it at the time, but there had been an nth-child answer, deleted.

提交回复
热议问题