如何從列表中刪除選中的複選框並將它們添加到另一個列表中?如何從列表中刪除選中的複選框並將它們添加到另一個列表
$('#mer').click(function() {
//var unchecked = [];
$('input[type="checkbox"]').each (function() {
if (this.checked) {
var txt = $(this).next("label").text();
$('#ch').append($('<li>').append($(this).clone()).append(txt));
$(':checkbox:checked').attr('disabled', true);
$(':checkbox:checked').remove();
//$('.checklist').hide();
$('#ch').show();
//$('input[type="checkbox"]:not(:checked)').show('.checklist');
} /*else {
unchecked.push(this);
var txt1 = $(this).next("label").text();
$('.checklist').append($('<li/>').append($(this).clone()).append(txt1));
$('.checklist').show();
}*/
});
你可能會有點更具描述性,並解決您的問題? – Exitos