title: Get value from div with javascript: Always get undefined
body: <p>I had this problem when I get the value from a div:</p>
  
  <pre><code>function sync(){
      var n1 = document.getElementById('editor').value;
      alert(n1);
      var n2 = document.getElementById('news');
      n2.value = n1;
  }
  </code></pre>
  
  <p>div with id <code>editor</code> looks like this:</p>
  
  <pre><code>&lt;div class='message'  id='editor' contenteditable="true" onkeyUp='sync()' style="color: black"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>When I put something in that div it will alert me undefined and that will also come in the textarea i paste it in too. So the problem is obviously by this:</p>
  
  <pre><code>var n1 = document.getElementById('editor').value;
  </code></pre>
  
  <p>What am I doing wrong?</p>