Skip to content

Instantly share code, notes, and snippets.

@nikkaroraa
Created November 13, 2017 19:19
Show Gist options
  • Save nikkaroraa/e3134c9ebe772659fdd02f95dd2c7f94 to your computer and use it in GitHub Desktop.
Save nikkaroraa/e3134c9ebe772659fdd02f95dd2c7f94 to your computer and use it in GitHub Desktop.
Deleting DOM Nodes
<!DOCTYPE html>
<html>
<head>
<title>DOM Manipulation</title>
</head>
<body>
<p id="paraId">First Paragraph</p>
</body>
<script>
//accessing the node with id="paraId"
var firstPara = document.querySelector('#paraId');
//deleting the element node
firstPara.parentNode.removeChild(firstPara);
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment