I’m using JavaScript to pull a value out from a hidden field and display it in a textbox. The value in the hidden field is encoded.
For example,
Picking what escapeHTML()
is doing in the prototype.js
Adding this script helps you escapeHTML:
String.prototype.escapeHTML = function() {
return this.replace(/&/g,'&').replace(//g,'>')
}
now you can call escapeHTML method on strings in your script, like:
var escapedString = "this is HTML
".escapeHTML();
// gives: "<h1>this is HTML</h1>"
Hope it helps anyone looking for a simple solution without having to include the entire prototype.js