Output valid xml with jquery.html() using XMLSerializer - Javascript jQuery

Javascript examples for jQuery:XML

Description

Output valid xml with jquery.html() using XMLSerializer

Demo Code

ResultView the demo in separate window


<html>
 <head> 
  <meta name="viewport" content="width=device-width"> 
 </head> /*from ww  w .  j a  v  a2 s  .  com*/
 <body> 
  <div id="test"> 
   <p data-test="&nbsp;"> Foo&nbsp;bar </p> 
   <script src="https://code.jquery.com/jquery-3.1.0.js"></script> 
  </div> 
  <script>
var s = new XMLSerializer();
var d = document;
var str = s.serializeToString(d);
console.log(str)

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

Related Tutorials