<!doctype html> <html lang="en"> <head> <title>JavaScript Editor</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta charset="utf-8"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> </head> <body onload="$('#page').html(localStorage.html)"> <button onclick="document.all.html.innerText=localStorage.html;document.all.editor.style.display='inline'">edit</button> <div style="display: none;" id="editor"> <button onclick="localStorage.html=document.all.html.innerText;location.reload()">save and reload</button> <br> <div id="html" contenteditable="true" style="border: 1px solid black;padding: 10px;"></div> </div> <div id="page"></div> </body> </html>