const form = document.getElementById('form');
const log = document.getElementById('log');
form.addEventListener('reset', logReset); // reset form input values
function logReset(event) {
log.textContent = `Form reset! Time stamp: ${event.timeStamp}`;
}
<form onreset="window.alert('All the information you entered will be cleared and the form will now be reset');">
Name: <input type="text" value=""/><br><br>
Email: <input type="text" value=""/><br><br>
Phone: <input type="text" value=""><br><br>
<input type="Reset" value="Reset"/> </form>
The onreset event handler is attached to the <form> tag,
not the actual reset button, but the tag of the form itself.
For the onreset event handler to work, the form button must be of type Reset.
Since the event handler handles resets of forms,
the button of the form must be of type reset.
This reset button click is what triggers the onreset event handler.