0

I have simple javascript:

function createNewCheckboxt(name, id){
    var elem = document.createElement('div');

    var checkbox = document.createElement('input');
    checkbox.type = "checkbox";
    checkbox.name = name;
    checkbox.value = name;
    checkbox.id = id;

    var label = document.createElement('label')
    label.htmlFor = id;
    label.appendChild(document.createTextNode(name));

    document.getElementById("brand").appendChild(elem);
    document.getElementById("brand").appendChild(checkbox);
    document.getElementById("brand").appendChild(label);
}

how to add class for styling? Because when I add div.class="checkbox" doesn't work

0 Answers0