Move Listbox items to another Listbox using jquery
<script type="text/javascript" src="Js/jquery-1.9.1.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$('#<%=btnAdd.ClientID %>').click(function () {
var selectedOptions = $('#<%=lstSource.ClientID %> option:selected');
if (selectedOptions.length ==
0) {
alert("Please select option to move");
return false;
}
$('#<%=lstTO.ClientID %>').append($(selectedOptions).clone());
$(selectedOptions).remove();
return false;
});
$('#<%=btnRemove.ClientID %>').click(function () {
var selectedOptions = $('#<%=lstTO.ClientID %> option:selected');
if (selectedOptions.length == 0) {
alert("Please select option to move");
return false;
}
$('#<%=lstSource.ClientID %>').append($(selectedOptions).clone());
$(selectedOptions).remove();
return false;
});
});
</script>
Hope this will helps you...........
Comments
Post a Comment