How to remove the first two BR tags with jquery?

前端 未结 6 1264
萌比男神i
萌比男神i 2021-01-13 05:14

I\'d like to remove only the first two BR tags with jquery.



// I want to remove both BR. ... <
6条回答
  •  醉梦人生
    2021-01-13 05:29

    Use :lt():

    $('#system br:lt(2)').remove();
    

    :lt() takes a zero-based integer as its parameter, so 2 refers to the 3rd element. So :lt(2) is select elements "less than" the 3rd.

    Example: http://jsfiddle.net/3PJ5D/

提交回复
热议问题