I'm putting together a script that checks multiple select inputs, verifying that they have been selected. I'm at the beginning, so the example here has only one field.
$("#passo_4").click(function(){
if($("#horario_ini_seg option:selected").val() == ''){
var his = 0;
} else{
var his = 1;
}
});
alert(his);
If I put the alert under each var, it works. If I put it out, it does not work.
If it works out, I want to make a var, adding all the values. If you give 0, you need to fill in some of the fields, otherwise, go to the next screen. There is a checkbox that I need to do the same, but I think it's the same case.
There are 14 inputs.
My idea is to check everyone in the click event.
But I do not understand why he does not take value the way I did.