Parse GET request string as HTML - Javascript String Operation

Javascript examples for String Operation:String Parse

Description

Parse GET request string as HTML

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=function(){//  w  ww. ja  va2  s . co  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>

Related Tutorials