3
I am assembling a script that checks several inputs select, checking whether 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 away, it doesn’t work.
If it works, I want to do a var, adding up all the values. If you give 0, you need to fill in some of the fields, otherwise, move to the next screen. There’s 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 event click.
But I don’t understand why he doesn’t take the value the way I did.
you are declaring the variable inside the if so only works under each value
– Bruno H.