// select the target element const e = document.querySelector("li:last-child"); // remove the list item e.parentElement.removeChild(e); Code language: JavaScript (javascript)