Last active
March 28, 2024 17:03
-
-
Save wpsunshine/f268bb9cb0f1abb938f8da2cf95b4bf7 to your computer and use it in GitHub Desktop.
Gravity Forms use enhanced UI on select drop down for lists
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
// For standard forms | |
jQuery( document ).on( 'gform_post_render', function( event, form_id, current_page ){ | |
gformInitChosenFields( '#field_12_10 select', 'No results matched' ); // Change selector to #field_FORMID_FIELDID | |
}); | |
// Forms that use multiple pages and ajax | |
jQuery( document ).on( 'gform_page_loaded', function( event, form_id, current_page ){ | |
gformInitChosenFields( '#field_12_10 select', 'No results matched' ); // Change selector to #field_FORMID_FIELDID | |
}); | |
</script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add to functions.php - this enqueues the Chosen.js JavaScript library | |
add_action( 'wp_enqueue_scripts', function() { | |
wp_enqueue_script( 'gform_chosen' ); | |
}, 999 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment