From my DOM element, I let the user choose a state.
In my code I go:
var State = $("select[name=state1]").val();
So if AZ was selected, the ouput would be State == "AZ"
Then I have arrays for every state so for example:
var AZ =[[1],[2]];
And I fill each array with some data. Then I try to do a calculation that looks like this:
var ABC = 25 * State[0][1];
However, the variable state
isn't an array. I want state
replaced by the chosen one, for example it might be AZ
so I actually want to calculate...
var ABC = 25 * AZ[0][1];
Any ideas on how I can pass the value of State
into last equation automatically?