Skip to content

Instantly share code, notes, and snippets.

@nikeedev
Created February 17, 2022 08:32
Show Gist options
  • Save nikeedev/2a5c1ebfb45990272f9670b6bc91be15 to your computer and use it in GitHub Desktop.
Save nikeedev/2a5c1ebfb45990272f9670b6bc91be15 to your computer and use it in GitHub Desktop.
Delete HTML/DOM elements using their name or id/class tag.
var answer = prompt("What element to delete?");
var lovedones = document.querySelector(answer);
lovedones.remove();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment