title: ckeditor update textarea from javascript
body: <p>I have used CKEditor a year now and everything has worked as it should.<br>
  Now I need to change the text in the textarea using javascript.<br>
  I have created an example that illustrates my problem.</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
    &lt;head&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;title&gt;CKEditor Sample&lt;/title&gt;
      &lt;script type="text/javascript" src="/ckeditor/ckeditor.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript"&gt;
        function othertext() {
          document.getElementById('button').value = 'xxx';
          document.getElementById('noteditor').innerHTML = '&lt;h1&gt;Hello other world!&lt;/h1&gt;&lt;p&gt;I&amp;#39;m also an instance of &lt;a href="http://ckeditor.com"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;';
          document.getElementById('editor').innerHTML = '&lt;h1&gt;Hello other world!&lt;/h1&gt;&lt;p&gt;I&amp;#39;m also an instance of &lt;a href="http://ckeditor.com"&gt;CKEditor&lt;/a&gt;.&lt;/p&gt;';
          CKEDITOR.replace('editor');    
        }  
      &lt;/script&gt;
    &lt;/head&gt;
    &lt;body id="main"&gt;
      &lt;input type="button" id="button" onclick="othertext();" value="NewText" /&gt;
      &lt;br&gt;
      &lt;textarea id=noteditor&gt;
        &lt;h1&gt;
          Hello world!
        &lt;/h1&gt;
        &lt;p&gt;
          I&amp;#39;m an instance of &lt;a href="http://ckeditor.com"&gt;CKEditor&lt;/a&gt;.
        &lt;/p&gt;
      &lt;/textarea&gt;
      &lt;br&gt;
      &lt;textarea name=text id=editor&gt;
        &lt;h1&gt;
          Hello world!
        &lt;/h1&gt;
        &lt;p&gt;
          I&amp;#39;m an instance of &lt;a href="http://ckeditor.com"&gt;CKEditor&lt;/a&gt;.
        &lt;/p&gt;
      &lt;/textarea&gt;
      &lt;script type="text/javascript"&gt;   
        CKEDITOR.replace('editor');    
      &lt;/script&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>When I click the button, the value of the button changes, the same with the first textarea (id=noteditor).<br>
  But textarea (id=editor) is not affected.<br>
  Why?<br>
  In debugger, when the line "CKEDITOR.replace('editor1');" in function othertext is executed I get &lt;exception&gt;:TypeError.<br>
  What am I doing wrong?<br></p>