I have 15 check boxes in a form. This checkboxes are independent to eachother. I want a javascript function that makes, when user is selecting 2 checkboxes, the first checke
Would you be better off using radio buttons instead of checkboxes as per this site: http://www.echoecho.com/htmlforms10.htm?
If you want to use check boxes I guess you could do something like this:
HTML Code:
Option 1
Option 2
Option 3
Option 4
Javascript Code :
function selectOnlyThis(id) {
for (var i = 1;i <= 4; i++)
{
document.getElementById("Check" + i).checked = false;
}
document.getElementById(id).checked = true;
}