commit | author | age | ||
38b8f3 | 1 | const buttonEl = document.querySelector('button'); |
CM | 2 | const inputEl = document.querySelector('input'); |
3 | const listEl = document.querySelector('ul'); | |
4 | ||
5 | function addGoal() { | |
6 | const enteredValue = inputEl.value; | |
7 | const listItemEl = document.createElement('li'); | |
8 | listItemEl.textContent = enteredValue; | |
9 | listEl.appendChild(listItemEl); | |
10 | inputEl.value = ''; | |
11 | } | |
12 | ||
13 | buttonEl.addEventListener('click', addGoal); |