演示鏈接http://www.designchemical.com/blog/index.php/jquery/create-add-remove-select-lists-using-jquery/
<form>
<fieldset>
<select name="selectfrom" id="select-from" multiple size="5">
<option value="1">Item 1</option>
<option value="2">Item 2</option>
<option value="3">Item 3</option>
<option value="4">Item 4</option>
</select>
<a href="JavaScript:void(0);" id="btn-add">Add »</a>
<a href="JavaScript:void(0);" id="btn-remove">« Remove</a>
<select name="selectto" id="select-to" multiple size="5">
<option value="5">Item 5</option>
<option value="6">Item 6</option>
<option value="7">Item 7</option>
</select>
</fieldset>
</form>
jQuery代碼
$(document).ready(function() {
$('#btn-add').click(function(){
$('#select-from option:selected').each(function() {
$('#select-to').append("<option value='"+$(this).val()+"'>"+$(this).text()+"</option>");
$(this).remove();
});
});
$('#btn-remove').click(function(){
$('#select-to option:selected').each(function() {
$('#select-from').append("<option value='"+$(this).val()+"'>"+$(this).text()+"</option>");
$(this).remove();
});
});
});
你可以嘗試更多地討論你的意思是你所無法「修改下拉列表的值?」您嘗試執行的操作到底是什麼,以及它不起作用? – Tinfoilboy