문제

If I have a string

str = "<" + "some text" + ">";  

How would I output this to a rich text editor, with the desire to also display the '<' and '>' surrounding the text?

도움이 되었습니까?

해결책

You need to use the HTML entities &lt; and &gt; instead of < and >, respectively.

str = "&lt;" + "some text" + "&gt;"
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top