javascript - Jquery SELECT2 is not loading -


this index file.

<?php     use yii\helpers\url;     use yii\helpers\html;     use yii\bootstrap\modal;     use kartik\grid\gridview;     use johnitvn\ajaxcrud\crudasset;      use johnitvn\ajaxcrud\bulkbuttonwidget;      crudasset::register($this);     $this->registerjs($this->render('script2.js'), \yii\web\view::pos_ready);     ?>     <div class="op-transaction-listing-index">         <div id="ajaxcruddatatable">             <?=gridview::widget([                 'id'=>'crud-datatable2',                 'dataprovider' => $listing,                 //'filtermodel' => $searchmodel,                 'pjax'=>true,                 'columns' => require(__dir__.'/_columns.php'),                 'toolbar'=> [                  ],                           'striped' => true,                 'condensed' => true,                 'responsive' => true,                     'resizablecolumns'=>true,                 'persistresize'=>true,                 'bordered'=> true,                       'panel' => [                     'type' => 'primary',                      'heading' => '<i class="glyphicon glyphicon-list"></i> op transaction listings listing',              ])?>         </div>     </div>      <?=  html::a('create',false,['id'=>'test','class'=>'btn btn-success pull-right'])?>      <?php modal::begin([         "id"=>"ajaxcrudmodal",         "footer"=>"",// need jquery plugin     ])?>     <?php modal::end(); ?> 

what click on table cell remove text within , append select2 dropdown.

$(document).ready(function(){     $('#crud-datatable2-container > table > tbody > tr:nth-child(1) > td:nth-child(2)').on('click',function(){         $(this).text('');         $(this).append('<select name="testing" class="form-control" id="testing"></select>');          $('select#testing').select2();     }); }); 

but keep showing uncaught typeerror: $(...).select2 not function..this type of error. have 1 script inside. did did wrong?


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -