I want to create multiple checkboxes with JavaScript. I tried the following:
var response= data;
var container = document.createElement('div');
var checkboxContainer = document.createElement('div');
checkboxContainer.setAttribute('class', 'checkbox');
var label;
var checkBox;
for(i=0;i<response.length;i++){
label = document.createElement('label');
checkBox = document.createElement('input');
checkBox.type = "checkbox";
checkBox.name = "selDates[]";
checkBox.value = response[i]['date'];
label.innerHTML = response[i]['date'] + " " + response[i]['typ'];
label.appendChild(checkBox);
checkboxContainer.appendChild(label);
container.appendChild(checkboxContainer);
}
$("#downloadContent").prepend(container);
As I can see in the chrome developer tools it creates all my checkboxes, but only display one. All labels are displayed.

As you can see, one checkbox is displayed with all (3) labels.

Here you can see a print screen of the code.
Why is there just one checkbox displayed? For your information, I use Bootstrap 3 and jQuery.
Thanks for your help!
Yanick
checkboxcss?checkboxor any other css style do anything to hide the other checkboxes?