title: CKEDITOR Send Content When Enter KeyPressed
body: <p>I want to create chat on web base. I use CKEDITOR for B,I,U,font type, font size just like Yahoo Messenger or other IM</p>
  <p>I've succeed catching the <kbd>enter</kbd> key, but I got this error when I call:</p>
  <pre><code>my_ckeditor_inctance_obj.setData('');
  </code></pre>
  <p>I call this because when press <kbd>enter</kbd> text will gone just like other chat program (FB, YM, etc)</p>
  <p>I used Chrome. Chrome's console said:</p>
  <blockquote>
  <p>Uncaught TypeError: Cannot call method 'equals' of null ckeditor.js:36<br />
  // Detail Error<br />
  d.range.getCommonAncestor ckeditor.js:36<br />
  (anonymous function) ckeditor.js:133<br />
  s ckeditor.js:54<br />
  j.enterkey.enterBlock ckeditor.js:53<br />
  (anonymous function)</p>
  </blockquote>
  <p>BUT, I used button send too. When I click send, it work perfectly.</p>
  <p>This my source code:</p>
  <pre><code>$(document).ready(function(){
  // Init CKEDITOR
  CKEDITOR.replace('editor1',{
      toolbar:[['Bold','Italic','Underline'],['Font','FontSize'],['TextColor','BGColor']]
  });
  
  // Handle for keypress. In this case is When ENTER key is press
  CKEDITOR.instances['editor1'].on('contentDom', function() {
      this.document.on('keydown', function(e){
          if(e.data.getKey() == 13){ // Do this code when ENTER is pressed
                  var temp=getContent();
                  console.log(temp);
          }
      });
  });
  });
  
  function getContent(){
  // Get the editor instance that you want to interact with.
  var oEditor = CKEDITOR.instances.editor1;
  
  // Get editor contents
  // http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#getData
  var temp=oEditor.getData();
  
  //set to blank again
  oEditor.setData(''); // This code make error --&gt; Uncaught TypeError: Cannot call method 'equals' of null ckeditor.js:36 BUT when click 'send' button this error didn't show.(send button use this function)
  return temp;
  }
  </code></pre>
  <p>How to fix that problem?</p>
  <p>UPDATE:<br />
  I found solution in here <a href="https://stackoverflow.com/questions/10602647/enter-key-for-save-textarea-values">enter key for save textarea values</a></p>
  <p>Special thanks to <a href="https://stackoverflow.com/users/250294/alfonsoml">AlfonsoML</a></p>