Javascript examples for String Operation:String HTML
Extract the text out of HTML string
<html> <head></head> <body> <script type="text/javascript"> function extractContent(value){/*w w w. j a va2 s . c o m*/ var div = document.createElement('div') div.innerHTML=value; var text= div.textContent; return text; } window.onload=function() { console.log(extractContent("<p>Hello</p><a href='http://w3c.org'>W3C</a>")); }; </script> </body> </html>