@@ -1129,46 +1129,46 @@ jQuery( function( $ ) {
11291129
11301130 $ ( this ) . val ( formatted_total ) ;
11311131
1132- //Does this number have an accepted minimum value?
1132+ // Does this number have an accepted min/max value?
11331133 if ( ! Give . form . fn . isValidDonationAmount ( parent_form ) ) {
11341134
1135- //It doesn't... Invalid Minimum
1135+ // It doesn't... add invalid class.
11361136 $ ( this ) . addClass ( 'give-invalid-amount' ) ;
11371137
1138- //Disable submit
1138+ // Disable submit
11391139 Give . form . fn . disable ( parent_form , true ) ;
1140- var invalid_minimum = parent_form . find ( '.give-invalid-minimum' ) ,
1141- invalid_maximum = parent_form . find ( '.give-invalid-maximum' ) ;
1140+ var invalid_minimum_notice = parent_form . find ( '.give-invalid-minimum' ) ,
1141+ invalid_maximum_notice = parent_form . find ( '.give-invalid-maximum' ) ;
11421142
1143- //If no error present, create it, insert, slide down (show)
1144- if ( invalid_minimum . length === 0 && value_now < value_min ) {
1143+ // If no error present, create it, insert, slide down (show)
1144+ if ( 0 === invalid_minimum_notice . length && value_now < value_min ) {
11451145 Give . notice . fn . renderNotice ( 'bad_minimum' , parent_form ) ;
1146- } else {
1147- invalid_minimum . slideUp ( 300 , function ( ) { $ ( this ) . remove ( ) ; } ) ;
1146+ } else if ( value_now > value_min ) {
1147+ invalid_minimum_notice . slideUp ( 300 , function ( ) { $ ( this ) . remove ( ) ; } ) ;
11481148 }
11491149
11501150 // For maximum custom amount error.
1151- if ( invalid_maximum . length === 0 && value_now > value_max ) {
1151+ if ( 0 === invalid_maximum_notice . length && value_now > value_max ) {
11521152 Give . notice . fn . renderNotice ( 'bad_maximum' , parent_form ) ;
1153- } else {
1154- invalid_maximum . slideUp ( 300 , function ( ) { $ ( this ) . remove ( ) ; } ) ;
1153+ } else if ( value_now < value_max ) {
1154+ invalid_maximum_notice . slideUp ( 300 , function ( ) { $ ( this ) . remove ( ) ; } ) ;
11551155 }
11561156
11571157 } else {
11581158
1159- // Remove error massage class from price field.
1159+ // Remove error message class from price field.
11601160 $ ( this ) . removeClass ( 'give-invalid-amount' ) ;
11611161
11621162 // Minimum amount met - slide up error & remove it from DOM.
1163- parent_form . find ( '.give-invalid-minimum,.give-invalid-maximum' ) . slideUp ( 300 , function ( ) {
1163+ parent_form . find ( '.give-invalid-minimum, .give-invalid-maximum' ) . slideUp ( 300 , function ( ) {
11641164 $ ( this ) . remove ( ) ;
11651165 } ) ;
11661166
11671167 // Re-enable submit.
11681168 Give . form . fn . disable ( parent_form , false ) ;
11691169 }
11701170
1171- //If values don't match up then proceed with updating donation total value
1171+ // If values don't match up then proceed with updating donation total value
11721172 if ( pre_focus_amount !== value_now ) {
11731173
11741174 // Update donation total (include currency symbol)
@@ -1201,7 +1201,7 @@ jQuery( function( $ ) {
12011201 Give . form . fn . autoSelectDonationLevel ( parent_form , price_id ) ;
12021202 }
12031203
1204- //This class is used for CSS purposes
1204+ // This class is used for CSS purposes
12051205 $ ( this ) . parent ( '.give-donation-amount' )
12061206 . removeClass ( 'give-custom-amount-focus-in' ) ;
12071207
0 commit comments