i have got two set of lists once complete and one incomplete… if i click on the complete line item it should be transferred to the incomplete list (prepend) and vice versa.
the code is real simple i am using basically similar code to transfer from incomplete to complete and complete to incomplete.
the incomplete to complete list transfer works.
the complete to incomplete transfer doesn’t. (the cloning process doesn’t seem to carry through.. it does clone the object makes the change to the cloned object but when i need it to prepend the cloned object to the incomplete list id it doesn’t do it.
https://jsfiddle.net/35nbpefz/2/
$("body").on("click", ".incompletetasklist", function () {
var id=$(this).attr('id');
var incomp_task=$(this).clone().addClass('completetasklist').addClass('bg-infolight').removeClass('incompletetasklist');
$('#quicktaskcomplete').prepend(incomp_task);
$("#"+id).remove();
});
// complete task to incomplete task
$("body").on("click", ".completetasklist", function () {
//console.log($(this).attr('id'));
var id=$(this).attr('id');
var comp_task=$(this).clone().addClass('incompletetasklist').removeClass('bg-infolight').removeClass('completetasklist');
//var comp_task=$(this).clone();
//console.log(comp_task);
$('#quicktaskincomplete').prepend(comp_task);
$("#"+id).remove();
});
i created a jsfiddle… i know this must be something so simple but i cannot see it .i have tried prependTo which has an entirely different result.not too sure what i am doing wrong .it is literally the same code… what am i doing wrong ?