i'm trying to make a kind of log in system whereas i'd have a string that would be got from user input and i want to check if that input is in a specific array…
What i got so far:
var name = $(".input").value();
var options = ["option_one", "option_two", "three"];
$(".submit").click(function() {
for(i=0; i < options.lenght; i++){
if(options[i] == name){
alert("true")
}else{
alert("false")
}
}
});
Can anyone help me out?
EDIT: CodePen