Javascript / jQuery - convert special html characters

后端 未结 2 1982
南笙
南笙 2021-02-09 12:15

I have a pre element with some html code in it. the code has special characters in it, like <, so it doesn\'t break the page.

Then I hav

2条回答
  •  一个人的身影
    2021-02-09 12:43

    You should be using the .text() method to grab the code from the pre. This way you are't giving the encoded symbols to the code highlighter.

提交回复
热议问题