Documenter l'élément de suppression
//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)