Answers for "js remove html tag from string"

1

remove the html tags in javascript

let strippedString = originalString.replace(/(<([^>]+)>)/gi, "");
Posted by: Guest on October-08-2020
3

javascript remove html from text

//remove html tags from a string, leaving only the inner text
function removeHTML(str){ 
    var tmp = document.createElement("DIV");
    tmp.innerHTML = str;
    return tmp.textContent || tmp.innerText || "";
}
var html = "<div>Yo Yo Ma!</div>";
var onlyText = removeHTML(html); "Yo Yo Ma!"
Posted by: Guest on July-31-2019

Code answers related to "js remove html tag from string"

Code answers related to "Javascript"

Browse Popular Code Answers by Language