Support

Account

Home Forums Backend Issues (wp-admin) Add Event to Select2 Field Reply To: Add Event to Select2 Field

  • so… I was able to find a *very hacky* solution:

    
    (function($) {
      
      acf.add_filter('select2_args', function( args, $select, settings, a ){
        
        var selectId = $select.attr('id');
    
        // this is what we need to bind the event to select2:
        var $input = $('input#'+selectId+'-input');
        $input.on( 'select2-selected', function (e) { 
          console.log( 'selected', e );
        });
    
        // return
        return args;
            
      });
      
    })(jQuery);