How can I set the value of a CodeMirror editor using Javascript?
I like examples. Try this:
CodeMirror.fromTextArea(document.getElementById(id), {
lineNumbers: true
}).setValue("your code here");
The way to do this has changed slightly since the release of 3.0. It's now something like this:
var textArea = document.getElementById('myScript');
var editor = CodeMirror.fromTextArea(textArea);
editor.getDoc().setValue('var msg = "Hi";');