I can transfer selected items from a multiple select element into another one :
<script language="javascript">
$().ready(function() {
$('#btnOne').click(function() {
return !$('#users_interdits option:selected').remove().appendTo('#users_autorises');
});
$('#btnUndoOne').click(function() {
return !$('#users_autorises option:selected').remove().appendTo('#users_interdits');
});
});
</script>
This code doesn’t take into account the “send all” functionnality in which case when I click a “send all” button then all remaining items within #users_interdits are transfered into #users_autorises.
How to do that ?
You only have to remove the
:selectedselector to match all options: