JSFiddle - React, Tailwind, and code Playground

by deadlyicon

HTML

<html>
  <head>
    <title>before we re-write the document</title>
  </head>
  <body>
    <p>before we re-write the document</p>
    <button>re-open the document</button>
  </body>
</html>

JavaScript

$(document).delegate('button', 'click', function(event){
  event.preventDefault();
 
  document.open();
  document.write('\
    <html>\
      <head>\
        <title>after we re-write the document</title>\
      </head>\
      <body>\
        <p>after we re-write the document</p>\
      </body>\
    </html>\
  ');
  document.close();

});