I am using ACE
editor for the first time. I have the below questions related to it.
How do I find the instance of
ACE
Lets assume that we have have initialized ace editor on a tag in html.
EX: <div id="MyAceEditor">this the editor place holder</div>
.
In the javascript section, after loading ace.js,
First step is to find your editor's instance as below.
var editor = ace.edit("MyAceEditor");
To get the value from ace editor, use getValue() method as below.
var myCode = editor.getSession().getValue();
To set the value to ace editor(to push some code into the editor), use setValue()
method as below.
editor.getSession().setValue("write your code here");