 <p>There is also the DOM way of doing this in JavaScript:</p> <pre><code>// Create a div and set class var new_row = document.createElement("div"); new_row.setAttribute("class", "aClassName" ); // Add some text new_row.appendChild( document.createTextNode("Some text") ); // Add it to the document body document.body.appendChild( new_row ); </code></pre>