title: How to get the value of Codemirror textarea
body: <p>I am using Codemirror's plugin for textarea but I am not able to retrieve the value of textarea.</p>
  
  <p>Code:</p>
  
  <pre><code>var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
      lineNumbers: true,
      matchBrackets: true,
      mode: "text/x-csrc"
    });
  
  
  function showCode()
  {
      var text = editor.mirror.getCode();
      alert(text);
  }
  </code></pre>
  
  <p>It is showing the error:</p>
  
  <pre><code>editor.getCode() is not a function.
  </code></pre>