How can I use onChange or a similar event for all form elements? I don't want to use onChange for each field separately.
onChange
form
You can use the change event on the form element:
change
var form = document.querySelector('form'); form.addEventListener('change', function() { alert('Hi!'); });
1.4m articles
1.4m replys
5 comments
57.0k users