Почему моя функция JavaScript не добавляет в список новый элемент для дел? [закрыто]Html

Программисты Html
Anonymous
Почему моя функция JavaScript не добавляет в список новый элемент для дел? [закрыто]

Сообщение Anonymous »

I'm creating a simple to-do list using HTML, CSS, and JavaScript.
When I click the "Add" button, I expect the new task to appear in the list, but nothing happens.
Here's my code:


function addTodo() {
const input = document.getElementById("todo-input");
const list = document.getElementById("todo-list");

const item = document.createElement("li");
item.textContent = input.value;

list.appendChild(item);
}< /code>

Add
    < /code>
    < /div>
    < /div>
    < /p>
    Я не вижу никаких ошибок в консоли, но список остается пустым.
    Что я делаю неправильно? < /p>

    Подробнее здесь: https://stackoverflow.com/questions/796 ... o-the-list

    Вернуться в «Html»