I am trying to reset every input that has been entered on this form when the "reset" button gets clicked. Below is my code that I tried using, the reset button wont reset anything. Thank you.
<form id="todoForm">
<input type="text" id="todoInput" placeholder="Input new note..">
<input type="text" id="description" placeholder="Input description..">
<button type="button" id="button" onclick="todoList()">Submit</button>
<button type="button" id="reset" onclick="resetForm()">Reset</button>
</form>
<ol id="todoList">
</ol>
function todoList() {
var item = document.getElementById("todoInput").value
var text = document.createTextNode(item)
var addItem = document.createElement("li")
addItem.appendChild(text)
document.getElementById("todoList").appendChild(addItem)
var item = document.getElementById("description").value
var text = document.createTextNode(item)
var addItem = document.createElement("p")
addItem.appendChild(text)
document.getElementById("todoList").appendChild(addItem)
}
function resetForm() {
document.getElementById(todoList).reset();
}
Don't add a reset button.
Assuming this is a todo app users can just delete the todo after creating it. Adding a reset button probably won't provide much value to users, instead it will most likely frustrate ones that click it by mistake.