I'm working on an input form with show/hide checkboxes: when a box is clicked, a div is shown with additional input parameters. I've got the show hide working, but I'm struggling to figure out how to uncheck all the other checkboxes when a box is checked (so users can only have one box checked at a time, like a radio list). Write now, my javascript function is this:
function toggleDivVisibility(id, numDivs) {
var div = document.getElementById('div'+id);
div.style.display = 'block';
for (var i=1; i<=numDivs; i++) {
if (i!=id) {
var div = document.getElementById('div'+i);
div.style.display = 'none';
}
}
for (var i=1; i<=numDivs; i++) {
if (i!=id) {
var cb=document.getElementByID(id);
cb.checked=false;
cb.onchange();
}
}
}
However, the checked/unchecked part at the bottom doesn't work. Any suggestions on how to get this working properly? I've attached my protocol as well, if my explanation of the question wasn't clear.