I've got the following javascript function:
function addConfirmLine(number, strItem, strValue) {
var confirmLine = document.getElementById("divConfirmation").appendChild(document.createElement("div"));
confirmLine.id = "divConfirmLine" + number;
var confirmItem = confirmLine.appendChild(document.createElement("div"));
confirmItem.className = "confirmItem";
confirmItem.nodeValue = strItem;
var confirmValue = confirmLine.appendChild(document.createElement("div"));
confirmValue.className = "confirmValue";
confirmValue.nodeValue = strValue;
}
and a div
like this
<div id="divConfirmation">
<div class="checkHead">
Check the following details. Click "Prev" to make corrections. Click "Upload" to process and upload the sermon.
</div>
</div>
The intent is to end up with something like this:
<div id="divConfirmation">
<div class="checkHead">
Check the following details. Click "Prev" to make corrections. Click "Upload" to process and upload the sermon.
</div>
<div id="divConfirmLine1">
<div class="confirmItem">Item1</div>
<div class="confirmValue">Value1</div>
</div>
<div id="divConfirmLine2">
<div class="confirmItem">Item2</div>
<div class="confirmValue">Value2</div>
</div>
</div>
Problem is it doesn't work. The new div
s don't appear, and I don't get any errors. What am I doing wrong?