Parse HTML string containing script tag and document.write - Javascript jQuery

Javascript examples for jQuery:String

Description

Parse HTML string containing script tag and document.write

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.0.js"></script> 
  <script type="text/javascript">
    $(window).load(function(){/* ww w.j a  v a2s  . c  o m*/
var code = "<script>document.write(\"Hello World\");</scr"+"ipt>";
$('body').append($(code)[0]);
    });

      </script> 
 </head> 
 <body>  
 </body>
</html>

Related Tutorials