How to get only direct text without tags with jQuery in HTML

后端 未结 8 545
忘了有多久
忘了有多久 2020-11-27 06:15

I\'ve got an HTML:

1)TEXT THAT I ONLY NEED

some par

    ..

I need only

8条回答
  •  南笙
    南笙 (楼主)
    2020-11-27 06:51

    Your markup isn't the greatest for this. If you wrapped the text you want with a span such as:

    TEXT THAT I NEED
    

    You could use $('.gettext').text(); in jQuery.

提交回复
热议问题