editor.getValue()
var textArea = document.getElementById('myScript'); var editor = CodeMirror.fromTextArea(textArea); editor.getDoc().setValue('var msg = "Hi";');