Skip to content

Commit

Permalink
Merge pull request #2742 from mehul0810/issue/2091
Browse files Browse the repository at this point in the history
Issue #2091 - Reset Form Fields on clicking browser back button
  • Loading branch information
ravinderk committed Jan 30, 2018
2 parents 93df522 + 4448b27 commit 0c7a520
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion assets/js/frontend/give.js
Expand Up @@ -94,7 +94,17 @@ jQuery( function( $ ) {

doc.on( 'change', '#give_profile_billing_address_wrap #give_address_country', update_profile_state_field );

} );
// Reset Form Fields on clicking back button of browser.
// @see https://developer.mozilla.org/en-US/Firefox/Releases/1.5/Using_Firefox_1.5_caching
// @see https://webkit.org/blog/427/webkit-page-cache-i-the-basics/
window.addEventListener( 'pageshow', function( event ) {
var historyTraversal = event.persisted || ( typeof 'undefined' !== window.performance && 2 === window.performance.navigation.type );

if ( historyTraversal ) {
$( 'body' ).find( 'form.give-form' )[0].reset();
}
});
});

/**
* Open form modal
Expand Down

0 comments on commit 0c7a520

Please sign in to comment.