[removed] make html text plain text

后端 未结 2 1303
暖寄归人
暖寄归人 2021-01-24 07:22

I\'ve got a js-function which takes string as a parameter and get it displayed in a div element. Such string may contain html tags.

How do I force JS display inner text

2条回答
  •  耶瑟儿~
    2021-01-24 08:20

    You just need to replace & and < (and optionally > if you like, but you don't have to) with their respective entities, using String#replace (spec, MDC) for instance.

提交回复
热议问题