dev4web
5/1/2012 - 3:33 PM

HTML Entities with jQuery and the Browser

HTML Entities with jQuery and the Browser

var div = $('<div/>');
function encodeEntities(str) {
    return div.text(str).html();
}
function decodeEntities(str) {
    return div.html(str).text();
}