How to create relationship between different data to perform an action?

1

This statement returns me the state acronym: SC

$("#billing\:city").val(dados.uf);

I have a select so I can not change:

<select id="billing:region_id" name="billing[region_id]">
   <option value="">Por favor, selecione o estado</option>
   <option value="485">Acre</option>
   <option value="486">Alagoas</option>
   <option value="487">Amapá</option>
   ...
   <option value="507">Santa Catarina</option>
</select>

How could I create a relationship between the acronym and the state code to select the status of the acronym?

As

    
asked by anonymous 12.04.2016 / 16:27

1 answer

2

I do not know if I understand correctly, but you can create attributes inside an html tag.

What I mean is this:

<select id="billing:region_id" name="billing[region_id]">
   <option value="" data-sigla="">Por favor, selecione o estado</option>
   <option value="485" data-sigla="AC">Acre</option>
   <option value="486" data-sigla="AL">Alagoas</option>
   <option value="487" data-sigla="AP">Amapá</option>
   ...
   <option value="507" data-sigla="SC">Santa Catarina</option>
</select>
    
12.04.2016 / 16:31