Document Delete Element
//removing element by ID
var element = document.getElementById("myElementID");
element.parentNode.removeChild(element);
Grepper
//removing element by ID
var element = document.getElementById("myElementID");
element.parentNode.removeChild(element);
// select the target element
const e = document.querySelector("li:last-child");
// remove the list item
e.parentElement.removeChild(e);
Code language: JavaScript (javascript)