Jquery: Strip all specific HTML tags from string

后端 未结 4 2092
攒了一身酷
攒了一身酷 2020-12-31 20:52

I have a variable that contains a string of text and html tags, such as:

var temp = \"
Some text

More texthere

4条回答
  •  旧巷少年郎
    2020-12-31 21:09

    You could try the jquery plugin HTML Clean. In the example they provide:

    $.htmlClean("

    Nested P Test

    ", {format:true}); =>

    Nested P Test

    You can replace specific tags with {removeTags:[p]} and it will still render the contents just not the tag.

提交回复
热议问题