I have many check-boxes on a page which appear like this, I don't know what the value is of these check boxes and as a result I don't know what the ID is:
<input value="78" type="radio" name="radio_tax_input[unit-type][]" id="in-unit-type-78">
<input value="90" type="radio" name="radio_tax_input[unit-type][]" id="in-unit-type-90">
<input value="3" type="radio" name="radio_tax_input[unit-type][]" id="in-unit-type-3">
I do know the names of the check-boxes though. I'm attempting to check if any number of these check-boxes have been checked, using jQuery:
var selected_type = $("[name='radio_tax_input[unit-type][]']:checked").length; // count the unit type selections
if(selected_type == 0){
alert('denied');
return false;
}
However my variable selected_type
is always set to 0. Could anyone suggest why?