Javascript examples for DOM:Element innerHTML
Process dynamic html string with dom method by adding it to innerHTML
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/*from www . jav a2 s. c o m*/ var htmlString = "<html><body><div class='class'>test!</div></body></html>" var htmlElem = document.createElement("html"); htmlElem.innerHTML = htmlString; console.log(htmlElem.getElementsByClassName("class")[0].innerHTML); } </script> </head> <body> </body> </html>