0
I have a page with a table where each row has 3 checkbox and each column has 11 lines with the 3 checkbox, I needed to do a validation where at least one checkbox of the 3 of each row is marked, and if on a line you have the 3 checkbox unchecked behind an error message I tried that logic and it’s not working
$("#submit").click(function(){
if($('#ok').not(":checked") && $('#nok').not(":checked") && $('#na').not(":checked")){
alert('erro');
}else if($('#ok1').not(":checked") && $('#nok1').not(":checked") && $('#na1').not(":checked")){
alert('erro');
}else if($('#ok2').not(":checked") && $('#nok2').not(":checked") && $('#na2').not(":checked")){
alert('erro');
}else if($('#ok3').not(":checked") && $('#nok3').not(":checked") && $('#na3').not(":checked")){
alert('erro');
}else if($('#ok4').not(":checked") && $('#nok4').not(":checked") && $('#na4').not(":checked")){
alert('erro');
}else if($('#ok5').not(":checked") && $('#nok5').not(":checked") && $('#na5').not(":checked")){
alert('erro');
}else if($('#ok6').not(":checked") && $('#nok6').not(":checked") && $('#na6').not(":checked")){
alert('erro');
}else if($('#ok7').not(":checked") && $('#nok7').not(":checked") && $('#na7').not(":checked")){
alert('erro');
}else if($('#ok8').not(":checked") && $('#nok8').not(":checked") && $('#na8').not(":checked")){
alert('erro');
}else if($('#ok9').not(":checked") && $('#nok9').not(":checked") && $('#na9').not(":checked")){
alert('erro');
}else if($('#ok10').not(":checked") && $('#nok10').not(":checked") && $('#na10').not(":checked")){
alert('erro');
}else if($('#sim').not(":checked") && $('#nao').not(":checked")){
alert('erro');
}else {
alert("checado");
}
});
someone can tell me where I’m going wrong, the idea is that of the 11 lines 1 line has the s 3 checkbox and of these 3 checkbox 1 must this marked of each line of the 11
table line1 [x] [] [] Linha2 [] [x] [] line3 [] [x] []
if all of them have a registered mark otherwise error as in the example below
table line1 [x] [] [] Linha2 [] [] [] <= error without marking line3 [] [x] []