I am trying to create a list of friends and to do this I will need to create a div for each one. The code I tried hasn't worked.
Relevant JavaScript (Now at bottom of page):
    document.getElementById("name").innerHTML = user;
        document.getElementById("profilePic").src = "users/" + user + "/profilePic.jpg";
    var friends = ["Test"];
    var friendArea = document.getElementById("friendsDiv");
    for (i=0; i < friends.length; i++) {
        var friendDiv = document.createElement("div");
        friendDiv.setAttribute("class", "friend");
        var friendImage = document.createElement("img");
        friendImage.setAttribute("class", "friendImage");
        friendImage.setAttribute("src", "users/" + friends[i] + "/profilePic.jpg");
        friendDiv.appendChild(friendImage);
        friendArea.appendChild(friendDiv);
    }
Relevant CSS:
    .friends {
        width: 100%;
        height: 90%;
        overflow-x: hidden;
        overflow-y: auto;
    }
    .tools {
        width: 100%;
        height: 10%;
        box-shadow: 0px 0px 3px 1px #898989;
    }
    .friend {
        width: 100%;
        height: 20%;
        padding: 1%;
    }
    .friendImage {
        height: 80%;
        width: auto;
        border: medium #CCCCCC solid;
        -webkit-border-radius: 50%;
        -moz-border-radius: 50%;
    }
The HTML isn't really important but I'll include it anyway.
    <div class="window">
        <div class="rightCorner">
            <img src="images/pPicTemp.png" id="profilePic">
        </div>
        <div class="holder" id="profileData">
            <span id="name"></span>
    </div>
    <div class="sideBar">
        <div class="friends" id="friendsDiv">
        </div>
        <div class="tools">
        </div>
    </div>
 
     
    