I-m trying to copy the value from one select to another. One has the value 'A' and the other has the value 'B'. Here's what I'm doing to achieve this:
$('#selectTipoInvervencion1').val($('#selectTipoIntervencion0').val());
However, my value is not getting copied. The weird thing is, I'm getting the elements correctly since after executing this line of code I can do:
console.log($('#selectTipoIntervencion0').val());
console.log($('#selectTipoIntervencion1').val());
and the output is:
A
B
which is what I expected since the value doesn't appear to be copied in the view but is obviously not what I want. How can I fix this?
Update: HTML
<select id="selectTipoIntervencion0" name="forms[0].model.intervenciones[0].tipo" class="selectTiposIntervencion">
<option name="A_NAME" value="A" selected="selected">A</option>
<option name="B_NAME" value="B">B</option>
...
</select>
<select id="selectTipoIntervencion1" name="forms[1].model.intervenciones[1].tipo" class="selectTiposIntervencion">
<option name="A_NAME" value="A" selected="selected">A</option>
<option name="B_NAME" value="B">B</option>
...
</select>