Javascript syntax issue -


here jsfiddle

its on phone method, no name one

now line right? want true if first 3 letters 087

var rightstarting3 = value.substring(0,2) == (087);    if (blankpass || lessthan10 ||  rightstarting3 || greaterthan10 || (hasspaces > 0))   {      document.getelementbyid('phone').style.background = "red";     return false;  }      else {     document.getelementbyid('phone').style.background = "white";     document.getelementbyid("phonetick").style.visibility="visible";     return true;   } 

value.substring(x) returns string , 087 , 87 mean same javascript interpreter. should change 1 of datatypes match...

either substring integer:

var rightstarting3 = parseint(value.substring(0,2)) == 87;

or value you're comparing against string:

var rightstarting3 = value.substring(0,3) == "087";

secondly -- invoking validatename() (in assignment namepass). necessary? there empty values on page load.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -