get value of text between br using jquery text()

前端 未结 1 676
别那么骄傲
别那么骄傲 2021-01-28 21:03

It\'s hard to work on terrible markup, it just not don\'t have class it look something like this:

p


br1
br2
br3
相关标签:
1条回答
  • 2021-01-28 21:47

    You can try to use nextSibling DOM property:

    $( 'br' ).each( function() {
        console.log( $( this ).get( 0 ).nextSibling.nodeValue );
    });
    

    jsFiddle

    0 讨论(0)
提交回复
热议问题