JavaScript: stripTags

Published on Author craigzearfossLeave a comment
/*
Strip html tags.

reference: http://davidwalsh.name/essential-javascript-functions
*/

function stripTags(htmlstr) {
var div = document.createElement('div');
div.innerHTML = htmlstr;
return div.textContent;
}

Leave a Reply

Your email address will not be published. Required fields are marked *