How to remove the first two BR tags with jquery?

前端 未结 6 1285
萌比男神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:41

    Try it. Replace (max 4 BR) to (1 BR)

    $('#system br').each(function() {
        if ($(this).next().is('br')) {
            $(this).next().remove();
        }
    });
    

    KS FIDDLE

提交回复
热议问题