I want to display a text to HTML by a javascript function. How can I escape html special chars in JS? Is there an API ?
Try this, using the prototype.js library:
prototype.js
string.escapeHTML();
Try a demo