Possible duplicate:
JavaScript: string contains
I have a zip code variable and you want to use JS to add location to another variable when zip code is changed / entered. So, for example, if ST6 is introduced, I would like to introduce Stoke North.
I somehow need to execute the if statement to run, for example,
if(code contains ST1) { location = stoke central; } else if(code contains ST2) { location = stoke north; }
etc...
How can i do this? It does not check if the "code" is equal to the value, but if it contains the value, I think this is my problem.
javascript variables if-statement postal-code
Sean hawkins
source share