js strip_tags

88

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