// By providing a list and an item, we can confirm before deletion function removeListItem (list, item) { // Only continue processing if they confirm if (confirm("Are you sure you wish to permanently remove this list item?")) { list.removeChild(item); } } // Assume "el" is the list item in question el.onclick = function () { removeListItem(document.getElementById('my-list'), this); };