Skip to content

Instantly share code, notes, and snippets.

@ChobPT
Last active December 17, 2023 01:21
Show Gist options
  • Save ChobPT/6d0d38dae0d072c7bdbfdb8a0de1e4f2 to your computer and use it in GitHub Desktop.
Save ChobPT/6d0d38dae0d072c7bdbfdb8a0de1e4f2 to your computer and use it in GitHub Desktop.
Fix Elementor + Select2's conflict on popups
/* Chob 2023
- Place this file on your theme and call it from functions.php OR,
- Simply copy the contents of this file and use Elementor > Code Blocks
to paste this code inside <script></script> tags.
Enjoy!
*/
jQuery(document).ready(function(){
jQuery( document ).on( 'elementor/popup/show', () => {
jQuery('.select2-hidden-accessible').each(function(){
var newOptions = jQuery(this).data('select2').options.options;
newOptions["dropdownParent"]= jQuery(this).parent();
jQuery(this).select2(newOptions);
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment