Answers for "button with onclick function remove ellem"

1

javascript remove item onclick

function remove(elem){
  elem.parentNode.removeChild(elem);
}
<div id="i", onclick="remove(this)">click</div>
Posted by: Guest on October-02-2020
0

as onclick delete this html tag

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.
}
Posted by: Guest on April-21-2021

Code answers related to "button with onclick function remove ellem"

Browse Popular Code Answers by Language