Monday, 24 November 2014

Revert a jQuery function, from xml to html and back



Hy all, i have to work with xml files in jQuery, and jQuery can't work with < > & and other codes, so i found this code on google:



function escapeHtml(text) {
var map = {
'&': '&amp;',
'<': '&lt;',
'>': '&gt;',
};
return text.replace(/[&<>]/g, function(m) {
return map[m];
});
}


its working for me, but now i need to export this file, and it returns with < > as text, is there a way to revert this back?


No comments:

Post a Comment