I am currently working on creating a code editor using ace.js. I want to add some boiler plate code every time page loads.
What I am doing till now it adding code snippet in HTML file itself like below-
<div class="editor-container">
<div id="editor" class="w-100"># Happy Coding ... a=10 b=20 print("This is the sum:", a+b) </div>
</div>
I tried setting editor.innerText=code snippet
, but its not working! How can I make this happen?
Use editor.setValue("code snippet")
.