function HTMLDecode(text) { var temp = document.createElement("div"); temp.innerHTML = text; var output = temp.innerText || temp.textContent; temp = null; return output; } console.log(HTMLDecode("<div style='color:red'>test</div>")); // test
function HTMLDecode(text) { var temp = document.createElement("div"); temp.innerHTML = text; var output = temp.innerText || temp.textContent; temp = null; return output; } console.log(HTMLDecode("<div style='color:red'>test</div>")); // test