// toggle complete tasks
$('.task-list li[data-status]').on('click', function (e) {
e.preventDefault();
// the target item must be marked as completed
if ($(e.target).attr('data-status') === '0') {
$(e.target).attr('data-status', 2);
} else {
$(e.target).attr('data-status', 0);
}
});
// remove completed tasks
$('.remove-completed').on('click', function (e) {
e.preventDefault();
// find all items with an attribute of data-status that equals 2 and remove them
$('.task-list li[data-status="2"]').remove();
});