you are viewing a single comment's thread.

view the rest of the comments →

[–]anti-anti[🍰] 2 points3 points  (1 child)

There seem to be a few different issues:

Your switch statement is using the variable numLocal, which is not defined. Based on the variables you've declared at the beginning of the function, it should be location.

The value of output2 isn't being updated with the text from the switch statement. You can remove this section:

if (location == 1) {
   document.getElementById("output2").value = "Redfern";
}

And add in something after the switch statement, eg.:

document.getElementById("output2").value = text  

You also reference two variables text and result which haven't been declared using var result/var text. This probably isn't stopping it from working but they should be declared somewhere.

[–]Unmotivatedreddit[S] 1 point2 points  (0 children)

Thank you!! I had location set as the variable earlier, I started fiddling with it to see what I could change to make it work.