I have a problem with some dynamic selection fields, what I want is that when changing one of the select (a) the other select (b) is also changed and vice versa, the problem is that it must be done using the data- attribute cod, for example if I select option 1 of select a, in select b you must select dynamically the option that corresponds to the same code of the data-cod attribute, I leave the code that I carry for the moment, thank you very much for the help.
var wrapper_sel = $(".content_select");
$(wrapper_sel).find('select').change(function(e){
e.preventDefault();
var cod = $(this).find("option:selected").attr("data-cod");
alert(cod);
})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="content_select">
<select id="a">
<option data-cod="1224" value="1">Opción 1</option>
<option data-cod="1130" value="2">Opción 2</option>
</select>
<select id="b">
<option data-cod="1224" value="a">Opción a</option>
<option data-cod="1130" value="b">Opción b</option>
</select>
</div>