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";');
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…