I got some objects with a property "title" in it.
When the body gets loaded, I want to create a new div foreach object existing.
When I do this, the div containers don't get created and there is now error listed up in the console.
Important: Obviously, my node list is not empty. I got a test routine with 10 objects in it. So when I write in my createNodeContainer
function
console.log(node.title);
it writes down the title of the object correctly. So I have the "content" but there are no div containers added to the div "nodeList"
So my current code looks this:
function loadNodes(){
var nodes = store.getNodes(); // get all the objects from a list
for (var i = 0; i < nodes.length; i++) {
createNodeContainer(nodes[i]); // pass in the current node of the nodeList
}
}
function createNodeContainer(node){ // create the new div
var newNodeContainer = document.createElement("div");
newNodeContainer.class = "nodeContainer"; // add some css
newNodeContainer.innerHTML = node.title; // write a text for testing it
$('nodeList').append(newNodeContainer); // add it to the parent div
}
and my Html is this:
<body onLoad ="loadNodes()">
<div id="nodeList">
</div>
</body>
Can someone help me out here?