createNewElement and appendChild to existing content
<p>I am trying to understand JavaScript a little better and am having trouble creating elements and appending values to them. </p>

<p>All I want to do is create a new paragraph element, which will contain a new string, and add the paragraph to my existing div tag using appendChild.</p>

<pre><code>var oldParagraph = document.getElementById('content')
var newParagraph = document.createElement('p');
var text = document.createTextNode("i am a new text node.");

newParagraph.setAttribute('class', 'red');

function addText(){
     document.oldParagraph.appendChild(newParagraph);
     document.newParagraph.appendChild(text);
}
</code></pre>

<p>my HTML is simple:</p>

<pre><code>&lt;div id="content"&gt;&lt;/div&gt;
</code></pre>
