I am trying to make a to-do list app and am trying to add a clickable checkbox next to each item as it is added to the list. I am very new to this, so any help would be greatly appreciated!
Thank you!
HTML
<form id="todoForm">
<h1>To Do List:<h1>
<input id="todoInput">
<button type="button" onclick="todoList()">Add Item</button>
</form>
<ul id="todoList">
</ul>
JS
function todoList() {
var item = document.getElementById('todoInput').value
var text = document.createTextNode(item)
var newItem = document.createElement("li")
newItem.appendChild(text)
document.getElementById("todoList").appendChild(newItem)
}
Aucun commentaire:
Enregistrer un commentaire