So I am trying to write javaScript to check my form. I have six radio-type inputs, of which one has to be checked. The radiobuttons are placed in two rows of three radio-inputs. One row has the name 'inschrijving1' and the other three inputs of the other row each has the name 'inschrijving2'. This is the code I used to check the form, but with this code it always returns as false and it always gives an alert.
if(!document.getElementsByName("inschrijving1").checked || !document.getElementsByName("inschrijving2").checked)
{
alert("Selecteer een dagdeel voor de inschrijving");
return false;
}
Can anyone see why this is? I only need it to return false and give an alert if none of the six radio-inputs is checked.
getElementsByNamereturns an array, because it's plural.