I have the following code and i would like to add check boxes based upon an array of values:
When i run the code it replaces the check box instead of appending a new one.
HTML
<span id="foo">
</span>
Javascript
function init() {
var values = ["value1", "Value2", "Value3", "Value4"];
for (i = 0; i < values.length; i++) {
document.getElementById("foo").innerHTML = '<label><input type="checkbox" value="' + values[i] + '_checkbox">' + values[i] + '</label><br>';
}
}
innerHTML += ...