The following is my editor code, when the user presses 'show editor text' button, the text in the div tag has to be saved and the same has to be displayed on the same page. How can I achieve this in HTML?
<!DOCTYPE html>
<html>
<head>
<title>ACE in Action</title>
<style type="text/css" media="screen">
#editor {
position: absolute;
top: 0;
right: 0;
bottom: 7%;
left: 0;
}
</style>
</head>
<body>
<div id="editor">
blah blah blah!
</div>
<script src="U:\hyd\code\JS\ace-builds-master\ace-builds-master\src-noconflict\ace.js" type="text/javascript" charset="utf-8"></script>
<script>
var editor = ace.edit("editor");
editor.setTheme("ace/theme/cobalt");
editor.getSession().setMode("ace/mode/gc");
</script>
<button type= "button" style="position: absolute; left: 10%; bottom: 2%;" id="execute" onclick="window.open('http://149.77.164.100:8180/FirstServlet/mygeco','_top','resizable=yes')">Click to execute</button>
<button type= "button" style="position: absolute; left: 25%; bottom: 2%;" id="editortxt" onclick="showstuff('editor');">Show editor text
</button>
</body>
</html>
----------------------------------EDIT---------------------------------
var edit = ace.edit("editor");
var code = edit.getSession().getValue();
window.open(code, _top);
added the above code, yet no output. I want to display the code on a new window, and then save it.