WordPress.org

Making WordPress.org

Changeset 7268


Ignore:
Timestamp:
06/05/2018 08:16:49 PM (3 years ago)
Author:
vedjain
Message:

Wordcamp Payment - Try to add class to select2 dropdown only if it was initialized

In some pages, select2 is not initialized, for egs, when vieweing approved budget. This was causing a javascript error, and was breaking the page.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/javascript/budget-tool.js

    r7267 r7268  
    231231            if( data.name === 'currency' && $.fn.hasOwnProperty( 'select2' ) ){
    232232                var currSelect2Box = this.$el.find( 'select' ).select2( { width: '100%' } );
    233                 currSelect2Box.data( 'select2' ).$dropdown.addClass( 'select2-currency-dropdown' );
     233                var initializedSelectBox = currSelect2Box.data( 'select2' );
     234                if ( initializedSelectBox ) {
     235                    initializedSelectBox.$dropdown.addClass( 'select2-currency-dropdown' );
     236                }
    234237            }
    235238
Note: See TracChangeset for help on using the changeset viewer.