I’m stuck. Trying to push input values into an array, which actually works, but then I want to get them out into an unordered list, and they don’t show up. What am I doing wrong?
const inputBtn = document.querySelector("#input-btn");
let myLeads = [];
const inputEl = document.querySelector("#input-el");
const ulEl = document.querySelector("#ul-el");
inputBtn.addEventListener("click", function() {
myLeads.push(inputEl.value);
console.log(myLeads);
});
for (let i = 0; i < myLeads.length; i++) {
ulEl.innerHTML += "<li>" + myLeads[i] + "</li>";
}
<input type="text" id="input-el" />
<button id="input-btn">SAVE INPUT</button>
<ul id="ul-el"></ul>