I'm developing a form that processes input information differently depending on the State the user is in. On my webpage I have a list of States in a drop down:
<div class="top-row" title="Select the proper state from the list.">
<select name="state-list" class="state-list" id="stateList" >
<option value=30>Select State</option>
<option value=0>AL</option>
<option value=1>AR</option>
<option value=2>CA</option>
<option value=3>CT</option>
<option value=4>DE</option>
<option value=5>DC</option>
<option value=6>GA</option>
</select>
</div>
In my javascript file I made an array called states and placed the States as arrays:
var state = { AL: [false, true, true, 0], AZ: [false, false, false, 0],
AR: [false, true, true, 0], CA: [false, false, false, 0],
CT: [false, true, true, 0], DE: [false, true, true, 0],
DC: [false, true, true, 0], GA: [false, true, true, 0]};
The problem I'm having is finding the array value. I've done a lot of searching, but I'm just not finding a solution.
findState = document.getElementById('stateList').value;
console.log(state.findState[0]);
They all return undefined, but 'findState' has a value. How can I access the values of the specific State's array within the state array?