I've got a regular drop downlist for selecting the countries name as text and countries_id as value. Example:
<option value="1">Afghanistan</option>
Now I need an hidden form field with the ISO2 code for the country. Example:
<input type="hidden" name="iso2" id="inputIso2" class="form-control">
And when the country is changed by the drop downlist, the hidden field should also change. I've added the ISO2 to the option like this:
<option value="1" data-iso2="AF">Afghanistan</option>
But how do I pass it to the hidden field? Or is there a better way of doing this?
The ISO2 field is being used by another script in the form, so it should work pre post.