Thursday, October 8, 2009

How to Add, Remove ListItems from one ListBox to Another in JQuery?

$(document).ready(function() {
$("#btnAdd").click(function() {
$("#ListBox1 > option[@selected]").appendTo("#ListBox2");
});
$("#btnAddAll").click(function() {
$("#ListBox1 > option").appendTo("#ListBox2");
});
$("#btnRemove").click(function() {
$("#ListBox2 > option[@selected]").appendTo("#ListBox1");
});
$("#btnRemoveAll").click(function() {
$("#ListBox2 > option").appendTo("#ListBox1");
});
});



1
2
3





No comments: