I have two sets of lists (state lists)
One called state_o and one called state_d and I have a function I do on them
function selectCountry(sel) {
document.getElementById("country_o").selectedIndex = states[sel.value];
}
Now what I want to do is determine if the “sel” is state_o or state_d and change the getElementById(“country_o”) to either _o or _d depending on what state is selected, so state_o would do country_o and state_d would do country_d
How can I determine the select field name?
Thanks!
You can access the name property through javascript:
Or if you want to be a bit fancier and keep it on one line, slice the o/d straight from the name string: