Created
November 13, 2017 19:19
-
-
Save nikkaroraa/e3134c9ebe772659fdd02f95dd2c7f94 to your computer and use it in GitHub Desktop.
Deleting DOM Nodes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!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