Possible Duplicate:
Escaping HTML strings with jQuery
JavaScript/jQuery HTML Encoding
For example, if I wanted to show the user the string x < 3 in HTML I would need to replace the < character with <. Is there a prebuilt function to do this in JavaScript or perhaps jQuery that converts any text string into the corresponding HTML?
If you want to use jQuery, you can use the
text(string)method.http://api.jquery.com/text/