How can I use change
or a similar event for all form
elements? I don't want to use change
for each field separately.
You can use the change
event on the form
element:
const form = document.querySelector('form');
form.addEventListener('change', function() {
alert('Hi!');
});