var sanitizeHTML = function (str) { var temp = document.createElement('div'); temp.textContent = str; return temp.innerHTML; };