Javascript split creating error for first entry

Check out this Jfiddle http://jsfiddle.net/TyJy4/9/

There is an array of users here. If the username is correct, you can go to the password field. The code works fine except when I enter the first entry (of the user) in the username for the first time.

Conditions when recording works user

  • When I type the user and a space, then tab (here it will cause an error saying that it does not exist in db.), Then backspace, then go to the password field.
  • When I type user2(or other users except the first), then type user.
+4
source share
1 answer

readonly, true. , ( ):

for (var j=0; j<names.length; j++){
if(names[j].localeCompare(x)==0){
        z.removeAttribute("readonly", 0);
        return true;
    }
}

:

if(names.indexOf(x) != -1){
    z.removeAttribute("readonly", 0);
    return true;
}

indexdOf(), , , ++, for.

0

All Articles