Created
November 27, 2019 03:59
-
-
Save Draketheb4dass/7ea65dad27f76f912d5c1c10618f1de2 to your computer and use it in GitHub Desktop.
Todo 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> | |
<body> | |
<ul id="myList"></ul> | |
<input id="myInput" /> | |
<button onclick="addItem()">Add</button> | |
<script> | |
function addItem() { | |
var node = document.createElement("LI"); | |
var inputValue = document.getElementById("myInput").value; | |
var textnode = document.createTextNode(inputValue); | |
node.appendChild(textnode); | |
document.getElementById("myList").appendChild(node); | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment