
var counter = 0;

function onClick() {
    var element = document.getElementById("element");
    console.log(element.value);
   
    add(element.value);
    
}

function add(input) {
    counter++;
    var liste = document.getElementById("liste");

    var checkbox = document.createElement("input");
    checkbox.setAttribute("type", "checkbox");
    checkbox.setAttribute("id", "cb" + counter);

    var label = document.createElement("label");
    label.innerHTML = input;
    label.setAttribute("for", "cb" + counter);

    liste.appendChild(checkbox);
    liste.appendChild(label);
    liste.appendChild(document.createElement("br"));
}