0
I have a input on my form with id="nome":
<input id="nome" name="nome" type="text" />
I would like the value of this input was the same as: "Jose", "maria" or "Joao".
I have the following function to check whether the value of input matches one of the above names:
function valida(){
campo = $("#nome");
if(campo.val() == "jose" || campo.val() == "maria" || campo.val() == "joao")
{
alert("Nome válido!");
}else{
alert("Nome inválido!");
}
}
It is possible instead of repeating campo.val() == "NOME" ||... for each name, make a more simplified comparison, without having to keep repeating campo.val() == for each name only on if, without using array or other subterfuge outside the function?
Ball show! Obg!
– Sam