I created two fields input
radio
for sex and put value="m"
and the other value="f"
. I left default as input
with value="m"
checked
(so that at startup it's checked), but when I send to JS, even if I set input
value="f"
, it returns me "m"
guilty of checked
input checked
is in the way, but I do not want to take it out.
This is my verification code for input radio
"sex". Each input
has a class()
with the same name. I gave one
querySelectorAll();
and I played it in the sexo
variable. The idea is: if the first input (((sexo[0])))
is checked, then it is m
, otherwise it is f
.
if(sexo[0].checked){
sexo1 = "m"
}else{
sexo1 = "f";
}