Skip to content

Commit

Permalink
gpadvs-clear-search-on-select.js: Added new snippet.
Browse files Browse the repository at this point in the history
  • Loading branch information
spivurno authored Nov 22, 2023
1 parent e565d87 commit b24213e
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions gp-advanced-select/gpadvs-clear-search-on-select.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* Gravity Perks // Advanced Select // Clear Search on Selection
* https://gravitywiz.com/documentation/gravity-forms-advanced-select/
*
* Clear the search term(s) after a selection has been made.
*
* Instructions:
*
* 1. Install this snippet with our free Custom JavaScript plugin.
* https://gravitywiz.com/gravity-forms-custom-javascript/
*/
gform.addFilter( 'gpadvs_settings', function( settings, gpadvs ) {
if ( gpadvs.formId == GFFORMID ) {
settings.onItemAdd = function(){
this.setTextboxValue('');
this.refreshOptions();
};
}
return settings;
} );

0 comments on commit b24213e

Please sign in to comment.