Last Updated: February 25, 2016
· moak

Resetting forms with jQuery

Surprised this is not part of the jQuery library

    $.fn.reset = function(fn) {
        return fn ? this.bind("reset", fn) : this.trigger("reset");

You can chain this function as expected and if you pass a function as argument you can do something whenever the form is reset via reset button or trigger.
Some simplified examples of use

//Scroll to top of screen when form is reset

//Reset the form when an icon is clicked