strip html tags javascript

55

js strip_tags -

let strippedString = originalString.replace(/(<([^>]+)>)/gi, "");

how to strip html tags in javascript -

function stripHtml(html)
{
   let tmp = document.createElement("DIV");
   tmp.innerHTML = html;
   return tmp.textContent || tmp.innerText || "";
}

Comments

Submit
0 Comments