Exercise 10.10

This commit is contained in:
Karan 2021-11-24 23:00:03 +05:30 committed by GitHub
parent 013df30370
commit 0a538f3702
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

30
Chapter 10/Exercise 10.10 Normal file
View File

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<title>Complete JavaScript Course</title>
<style>
</style>
</head>
<body>
<div id="message">Complete JavaScript Course</div>
<div>
<input type="text" id="addItem">
<input type="button" id="addNew" value="Add to List"> </div>
<div id="output">
<h1>Shopping List</h1>
<ol id="sList"> </ol>
</div>
<script>
document.getElementById("addNew").onclick = function () {
addOne();
}
function addOne() {
var a = document.getElementById("addItem").value;
var li = document.createElement("li");
li.appendChild(document.createTextNode(a));
document.getElementById("sList").appendChild(li);
}
</script>
</body>
</html>