function remove() { var element = this.id; //I have also tried using document.getElementByID(this.id) element.remove(); //I have also tried using element.parentNode.removeChild(element); to remove the element. }