I use ace.js. I create my online editor and I have one problem. I want when I wrote the code in textarea and saved it (when saving the code should go to localstorage), when the page was reloaded, exactly the code I saved was displayed (that is, to find the saved code from the localstorage). This code should go to textarea .
var eh = ace.edit("htmlEditor"); eh.setTheme("ace/theme/monokai"); eh.session.setMode("ace/mode/html"); document.getElementById('htmlEditor').style.fontSize='15px'; eh.getSession().on('change', function() { update(); }) function update() { var res = document.getElementById('result').contentWindow.document; res.open(); res.write(eh.getValue()); res.close(); } update(); #menu-code { font-size: 1.2em; } .save { list-style-type: none; cursor: pointer; } #htmlEditor { height: 100%; min-height: 43vh; width: 33.03%; display: inline-block; } <!DOCTYPE html> <html> <head> <meta charset="utf 8"> <title>Finance</title> <link rel="stylesheet" href="css/style.css"> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.3.3/ace.js"></script> </head> <body> <div id="header-code"> <div id="menu-code"> <ul class="mnu-code"> <li class="save" onclick="saveFiles()"> Сохранить</li> </div> </div> <div id="htmlEditor"></div> <div id="result-block"> <iframe id="result" frameborder="0"></iframe><div id="line4"></div></div> </body> </html> Help me please.