سؤال

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