If you want to remove the parent in Javascript, you must first select it (yourElement.parentElement) and remove it by using yourParentElement.remove(). parentElement doc | remove() doc