Strip HTML Tags using Javascript

So folks, sometimes it happens that you are saving some text with formatted data like HTML string but while displaying you don’t want to display it not as string but as formatted text.i.e. want to stripĀ  HTML tags from the content here is the slution for it:


function stripTags(html) {
var tmp = document.createElement("DIV");
tmp.innerHTML = html;
return tmp.textContent || tmp.innerText || "";