I want to get an instance of CodeMirror (it is binded to a textarea \'#code\'). From an onclick-event I want to add a value to the current value of the CodeMirror instance.
Another method I have found elsewhere is as follows:
//Get a reference to the CodeMirror editor var editor = document.querySelector('.CodeMirror').CodeMirror;
This works well when you are creating the CodeMirror instance dynamically or replacing an existing DOM element with a CodeMirror instance.