Nowhere in the jQuery online documentation or in Swedberg & Chaffer can I find that form "reset" is an event that can be bound to a handler. I got the job done by giving the form reset input an id and binding the "click" event to a handler. I needed to reset a date input on the form to "today's date" upon the clicking of the reset button. Trouble with that is that after the onclick handler the normal reset behavior occurs and clears the date to nothing again. So, I used the window.setTimeout() function to call the date adjustment 100mSec later (after the normal reset behavior has finished) and now I'm done. It just seems inelegant.
The limitation I have found is that the reset event doesn't bubble in IE. Also, in at least IE and FF (the ones I've tested so far) form element values haven't actually been reset yet when you handle the reset event, so even if you bind directly to the form reset even, not the reset button click as t22harris suggests, you still need a
setTimeout(function() {}, 1)
inside your reset handler to get the reset values, if those are important to you.
The docs for.bind() say, "All JavaScript event types, such as focus, mouseover,
and resize, are allowed for eventType." Since reset is a JS event, it is supported.
Leave a comment on dave.methvin's reply
Change topic type
Link this topic
Provide the permalink of a topic that is related to this topic