title: CodeMirror and Socket.io- Emitting the Contents of the Editor with onChange
body: <p>I'm trying to submit the contents of the editor to my server onChange.
  I'm using node.js, socket.io, jquery, and codemirror.</p>
  
  <p>This is my code thus far (client-side) ("code.server" means that I'm sending the code-textarea contents to my server.  I use "code.client" to send information back to the client):</p>
  
  <pre><code>&lt;textarea id="code"&gt;&lt;/textarea&gt;
  &lt;script&gt;
  var socket = io.connect();
  
  var editor = CodeMirror.fromTextArea(document.getElementById('code'), {
                  lineNumbers: true,
              matchBrackets: true,
              onChange: function(){
              var value = getValue();
              socket.emit("code.server", value);
              }
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>Yet it isn't working.  What am I doing wrong?  I could submit the contents of the textarea before I added CodeMirror:</p>
  
  <pre><code>&lt;script&gt;
  $("#code").keyup(function () {
          var value = $(this).val();
          socket.emit("code.server", value);
  }).keyup();
  &lt;/script&gt;
  </code></pre>
  
  <p>I used jQuery, in case that wasn't clear.</p>
  
  <p>And now, after adding codemirror, I can't get the contents and send them to the server.  What is going on?  Thank you for helping me, I've been working on this problem for several days, it's driving me crazy.</p>