How to strip HTML tags with jQuery?

后端 未结 5 942
别跟我提以往
别跟我提以往 2020-11-27 04:12

I want to remove HTML tags from a string. For example assume we have the string:

 

example ive got a string

How can I wr

5条回答
  •  独厮守ぢ
    2020-11-27 04:30

    You can use the existing split function

    One easy and choppy exemple:

    var str = '

    example ive got a string

    '; var substr = str.split('

    '); // substr[0] contains "" // substr[1] contains "example ive got a string

    " var substr2 = substr [1].split('

    '); // substr2[0] contains "example ive got a string" // substr2[1] contains ""

    The example is just to show you how the split works.

提交回复
热议问题