Monday, May 13, 2024
 Popular · Latest · Hot · Upcoming
98
rated 0 times [  99] [ 1]  / answers: 1 / hits: 26460  / 14 Years ago, sun, july 25, 2010, 12:00:00

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 have a javascript function that gets the contents of this pre element, highlights it (with codemirror), and replaces the element contents with the highlighted text.



I'm using $(pre).append(...); to do this.
The problem is that after the highlighting, on the screen I see &lt; instead of <.
How can I convert these characters back to html?


More From » jquery

 Answers
6

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.


[#96114] Thursday, July 22, 2010, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
clarkulisesa

Total Points: 422
Total Questions: 93
Total Answers: 112

Location: Austria
Member since Thu, Jan 7, 2021
3 Years ago
clarkulisesa questions
Mon, Feb 24, 20, 00:00, 4 Years ago
Mon, Aug 12, 19, 00:00, 5 Years ago
;