title: How to write to a <div> element using JavaScript?
body: <p>I've searched around using Google and Stack&nbsp;Overflow, but I haven't seemed to find a answer to this. I want to write text inside a &lt;div> element, using <a href="http://en.wikipedia.org/wiki/JavaScript" rel="nofollow">JavaScript</a>, and later clear the &lt;div> element, and write more text into it. I am making a simple text adventure game.</p>
  
  <p>This is what I am trying to do:</p>
  
  <pre><code>&lt;DOCTYPE!HTML&gt;
      &lt;body&gt;
          &lt;div class="gamebox"&gt;
              &lt;!-- I want to write in this div element --&gt;
  
          &lt;/div&gt;
      &lt;/body&gt;
  </code></pre>
  
  <p>As a new user to JavaScript, how would I be able to write inside the <code>div</code> element gamebox? Unfortunately, my JavaScript skills are not very good, and it would be nice if you can patiently explain what happens in the code.</p>