removing html tags from string

前端 未结 3 1243
死守一世寂寞
死守一世寂寞 2021-01-29 07:24

I am trying to remove the HTML tags from a string. Right now I am able to remove the complete HTML tags like for example

dadsasdsad
3条回答
  •  灰色年华
    2021-01-29 07:46

    my simple JavaScript library has a function called "strip_tags()" which does the long work for you.

    Just say that you have a sentence loaded with HTML formatting tags, and you want to remove them, simply do it like this:

    strip_tags("

    This sentence contains a lot of tags!

    ");

    This will output "This sentence contains a lot of tags!" (tested on the documentation website).

    To read more about this function, please read the documentation at http://docs.funcjs.webege.com/strip_tags().html and if possible, leave feedback through the Feedback Form on the website.

    Hope this helps you and anyone else with the same problem! :)

提交回复
热议问题