1 | $( '#selectedfile' ).select2( 'data' )[0].text |
To check if it’s really the value, use:
1 2 3 4 5 | $(document).ready( function (){ $( "button" ).click( function (){ alert( "Value: " + $( '#selectedfile' ).select2( 'data' )[0].text); }); }); |
Widget should have selectedfile as id in the options.
1 2 3 4 5 6 7 8 9 10 | field($model, 'filename' )->widget(Select2::classname(), [ 'data' => ArrayHelper::map(Uploads::find()->where([ 'category' => 'Mailing Fee Existing Record' ])->all(), 'excelFile' , 'excelFile' ), 'language' => 'en' , 'options' => [ 'placeholder' => 'Select File' , 'id' => 'selectedfile' ], 'pluginOptions' => [ 'allowClear' => true ], ]); ?> |
0 Comments