Select a checkbox by passing in the checkbox id - Node.js HTML

Node.js examples for HTML:Checkbox

Description

Select a checkbox by passing in the checkbox id

Demo Code


function toggleChoice(elementId) {
    var element = document.getElementById(elementId);
    if (element.checked) {
        element.checked = false;/*from  w  ww  . jav a2s  .co m*/
    } else {
        element.checked = true;
    }
}

Related Tutorials