select list add and remove php jquery demo
<script type="text/javascript" src="http://localhost/online/jquery.js"></script>
<script>
$(function() {
$(".low input[type='button']").click(function(){
var arr = $(this).attr("name").split("2");
var from = arr[0];
var to = arr[1];
$("#" + from + " option:selected").each(function(){
$("#" + to).append($(this).clone());
$(this).remove();
});
});
})
</script>
<div class="container">
<select name="itemsToChoose" id="left" size="8" multiple="multiple">
<option value="1">item1</option>
<option value="2">item2</option>
<option value="3">item3</option>
<option value="4">item4</option>
<option value="5">item5</option>
</select>
</div>
<div class="low container">
<input name="left2right" value="add" type="button">
<input name="right2left" value="remove" type="button">
</div>
<div class="container">
<select name="itemsToAdd" id="right" size="8" multiple="multiple">
</select>
</div>
<script type="text/javascript" src="http://localhost/online/jquery.js"></script>
<script>
$(function() {
$(".low input[type='button']").click(function(){
var arr = $(this).attr("name").split("2");
var from = arr[0];
var to = arr[1];
$("#" + from + " option:selected").each(function(){
$("#" + to).append($(this).clone());
$(this).remove();
});
});
})
</script>
<div class="container">
<select name="itemsToChoose" id="left" size="8" multiple="multiple">
<option value="1">item1</option>
<option value="2">item2</option>
<option value="3">item3</option>
<option value="4">item4</option>
<option value="5">item5</option>
</select>
</div>
<div class="low container">
<input name="left2right" value="add" type="button">
<input name="right2left" value="remove" type="button">
</div>
<div class="container">
<select name="itemsToAdd" id="right" size="8" multiple="multiple">
</select>
</div>