Tühjendage HTML JS-is - CSS-trikid

Anonim
function htmlDecode(input)( var e = document.createElement('div'); e.innerHTML = input; return e.childNodes.length === 0 ? "" : e.childNodes(0).nodeValue; )

Kasutamine

htmlDecode(""); // returns ""