cannot for the life of me figure out why newTask is returning undefined instead of the input value from my form.
Heres my HTML code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<h1>Todo List!</h1>
<form action="" id="addTask">
<label for="newTask"></label>
<input type="text" placeholder="Task" id = "newTask">
<input type="submit" >
</form>
<ul id = "tdList">
</ul>
<script src="myTodo.js"></script>
</body>
</html>
and heres my Js:
const form = document.querySelector('#addTask');
const input = document.querySelector('#newTask');
const tdList = document.querySelector('#tdList');
form.addEventListener('submit', function(e) {
e.preventDefault();
const newTask = document.createElement('li');
console.log(input.value);
newTask.innerText = input.Value;
input.value = '';
tdList.appendChild(newTask);
});