live example of project: http://jsfiddle.net/k3buckuc/
enterItem = []
itemNumber = 0
// mark item as checked and add delete functionality
function check() {
$('#itemsListed').on('click', 'li', function() {
$(this).toggleClass('checked');
$(this).append('<hr />');
$(this).append('<button class="trash">X</button>');
$(this).not('.checked').find('hr').remove();
$(this).not('.checked').find('button').remove();
// enable trash or delete functionality individual list items
$('.trash').on('click', function() {
$(this).closest('li').remove();
});
});
}
this only executes properly when itemNumber is odd, or when enterItem contains an odd number of items
see the fiddle to check how I am pushing items into the array and my increment technique