1//remove html tags from a string, leaving only the inner text
2function removeHTML(str){
3 var tmp = document.createElement("DIV");
4 tmp.innerHTML = str;
5 return tmp.textContent || tmp.innerText || "";
6}
7var html = "<div>Yo Yo Ma!</div>";
8var onlyText = removeHTML(html); "Yo Yo Ma!"
9