Here i am selecting a single li item in one list and on click of the add button the selected item will be moved to the next lsit
$("#list3 li").click(function () {
$("#list3 li").removeClass('clicked');
$(this).addClass('clicked');
});
$("#add").click(function () {
$("#list3 li.clicked").removeClass("clicked").appendTo('#list4');
});
and
.clicked {
border: 3px solid blue;
}
Here i need to select multiple li items using the control key and if i click add button all the selected li items has to be moved to another list..Any suggestion?
Well, if you need to select multiple items then you need to modify the code that unselects every item except the last one you clicked:
I also changed
addClass('clicked')totoggleClass('clicked')so that you can also unselect items by clicking on them again. The rest of your code does not need to change.See it in action.