I am creating a web form using jQuery.
I want to copy the previous selection fields to another selection field using the link. I am changing the DOM, changing the value of select1.selectedIndex. however, it still visually displays the old value. apparently you need to update it so that it is visually updated. I do not understand the syntax of the update method, which I continue to read. This is how I tried to do this and it does not work.
this is html for reference
<select name="entry.14.single" id="entry_14">
<option value="1"></option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option></select>
<select name="entry.16.single" id="entry_16">
<option value=1""></option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option></select>
<a href="#" onclick="setSelect('entry_16', 'entry_14');return false;">Same as above</a>
here is my javascript:
function setSelect(id1, id2){
var select1 = document.getElementById(id1);
var select2 = document.getElementById(id2);
select1.selectedIndex = select2.selectedIndex;
$('#select1').selectmenu('refresh');
}
can someone tell me why my update statement is not working?
p.s. , , "". , - . . , , , .
EDIT: heres jsfiddle,
http://jsfiddle.net/AFzqt/7/