Answers for "decode html entities"

0

decode html entities

function htmlDecode(input) {
  const doc = new DOMParser().parseFromString(input, "text/html");
  return doc.documentElement.textContent;
}

console.log(  htmlDecode("<img src='myimage.jpg'>")  )    
// "<img src='myimage.jpg'>"
Posted by: Guest on April-20-2022

Browse Popular Code Answers by Language