Injecting table into specific class
<p>When I generate this table it is generated after the rest of the code is executed.</p>

<p>I want to be able to generate the code into a specific class like ".container".</p>

<p>How would I do this?</p>

<pre><code>var listOfWords = [];
var rndWord = [];
var counter = 0;
var ul = document.getElementById("wordlist");
var i;

for (i = 0; i &lt; ul.children.length; ++i) {

    listOfWords.push({
        "name": ul.children[i].getAttribute("data-word"),
        "pic": ul.children[i].getAttribute("data-pic"),
        "audio": ul.children[i].getAttribute("data-audio")
    });
}

var chosenWords = [];
var copylist = listOfWords.slice();

for (var x = 0; x &lt; 6; x++) {
    var rand = Math.floor(Math.random() * (copylist.length));
    chosenWords.push(copylist[rand].name);
    copylist.splice(rand, 1);
    if (chosenWords.length &lt; 12) {
    chosenWords.push('   ');
   }

}

var shuffledWords = [];
shuffledWords = chosenWords.sort(function() {
    return 0.5 - Math.random()
});

var guesses = {};
var tbl = document.createElement('table');
tbl.className = 'tablestyle';
var wordsPerRow = 2;

for (var i = 0; i &lt; shuffledWords.length - 1; i += wordsPerRow) {

    var row = document.createElement('tr');
    for (var j = i; j &lt; i + wordsPerRow; ++j) {
        var word = shuffledWords[j];
        guesses[word] = [];

         for (var k = 0; k &lt; word.length; ++k) {
            var cell = document.createElement('td');


            $(cell).addClass('drop-box').attr('data-word', word).attr('data-letter',         word[k]);
            cell.textContent = word[k];

            row.appendChild(cell);
        }
    }
    tbl.appendChild(row);
}

document.body.appendChild(tbl);
</code></pre>

<p>I thought changing the bottom line of this code from </p>

<pre><code>document.body.appendChild(tbl); 
</code></pre>

<p>to </p>

<pre><code>document.container.appendChild(tbl); 
</code></pre>

<p>would do it but it didn't.</p>

<p>Does anyone know how to put this table into container? </p>
