Issue
I have been making a to do list and i have stumbled upon a problem. There is a button to add to list but it is an empty green square.
I tried to make a button that adds to a list. It should say add to list. Instead it is an empty square. How can i solve it? Here is the code:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>To-Do list</title>
<style>
input[type="button"] {
background-color: green;
}
</style>
<script>
function addToList() {
var newItem = document.createElement("div");
newItem.innerHTML = document.getElementById("box").value;
document.getElementById("list").appendChild(newItem);
}
</script>
</head>
<body>
<p>To-do list</p>
<br/>
<input type="text" id="box" value="enter something">
<br/>
<input type="button" vaule="Add to list"
onclick="addToList();"/>
<br/>
<div id="list"></div>
</body>
</html>
Solution
<input type="button" vaule="Add to list"
this should be:
<input type="button" value="Add to list"
Answered By - Marwan Rabi
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.