Created
June 28, 2017 11:11
-
-
Save OlehRovenskyi/c436a6a8c0dc2845556ad544494fa198 to your computer and use it in GitHub Desktop.
dom manipulation
This file contains 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 lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Title</title> | |
</head> | |
<body> | |
<div id="dom"></div> | |
<script src="main.js"></script> | |
</body> | |
</html> |
This file contains 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
var el = document.getElementById('dom'); | |
var div = document.createElement('div'); | |
var text = document.createTextNode('Text'); | |
div.appendChild(text); | |
div.setAttribute('id', 'child'); | |
el.appendChild(div); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment