javascript string replace < into <
You could use something like the unescapeHTML()
function in prototype...
Adapted from prototype js source
function unescapeHTML(escapedHTML) {
return escapedHTML.replace(/</g,'<').replace(/>/g,'>').replace(/&/g,'&');
}
Simple.
var needToConvert = 'But I want to turn "<" and ">" into "<" and ">".';
var convert = function(convert){
return $("<span />", { html: convert }).text();
//return document.createElement("span").innerText;
};
alert(convert(needToConvert));