Suppose we have an initialized ace editor on a tag in html. EX: <div id="MyAceEditor">this the editor place holder</div> .
In javascript section after ace.js loading
The first step is to find a copy of your editor, as shown below.
var editor = ace.edit("MyAceEditor");
To get the value from the ace editor, use the getValue () method, as shown below.
var myCode = editor.getSession().getValue();
To set the value in the ace editor (to insert some code into the editor), use the setValue() method, as shown below.
editor.getSession().setValue("write your code here");
Sairam Venkata Nov 29 '13 at 7:35 2013-11-29 07:35
source share