Forms have specific events for user input:
form.addEventListener("submit", handleSubmit);
input.addEventListener("input", (e) => {
// Fires on every change
console.log(e.target.value);
});
input.addEventListener("change", (e) => {
// Fires when field loses focus
});
input fires on every keystroke. For text fields, change fires when the user leaves the field. For checkboxes, radios, and selects, change fires right away.