I am working on a spelling game for my children, and I want to display a spelling list based on what they enter and an array that is created. Here is the link to my project on github https://github.com/urock24/myWebSite.git
Here is the code in question, javascript first
function populateSpellList() {
// for loop should run through spelling list array and create list items in "listSpelling"
for (var i = 0; i < spellingList.length; i++ ) {
// create a new li
var newLI = document.createElement("li");
var indSpellingWord = spellingList[i];
// grab the spelling list item
var newContent = document.createTextNode(indSpellingWord);
// add the spelling list item to the li
newLI.appendChild(newContent);
// get the unordered list and add the new li
var displaySpellList = document.getElementById("listSpelling");
displaySpellList.appendChild(newLI);
}
}
And the HTML
<div id = "theSpellingList">
<h3>The Spelling List</h3>
<ul id = "listSpelling">
<li>test </li>
</ul>
</div>
I can get an alert to pop up for me after every line in the function except the last, and it only seems to pop up once. But no matter what happens it is not displaying any list items in that list.
I have seen a lot of jquery examples on here so I am definitely going to be pursuing learning jquery, but for now "plain" javascript would be great.