Cleanup code to add div structure to element
You should let CSS handle most of the job for you. Example

JS:

var a = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'];
var count = 1;
var html = '';
for (var i = 0; i &lt; a.length; i++) {
    var div = $("&lt;div&gt;" + a[i] + "&lt;/div&gt;");
    $('#container').append(div);
}


CSS (where the magic is):

#container div:nth-child(3n+1) { /* Every third! */
    clear: both;
}

#container div {
    float: left;
    width: 100px;
}