选择选项在我的控制台中完美运行时无法以我的模式形式工作

问题描述

任何人都可以帮助我解决我的问题,当我运行控制台时,模式显示模式中的select选项无法正常工作,但是不知道为什么在显示模式窗体时无法正常工作。请参阅下面的附件照片。

modal form

console

这是我的Ajax代码。.我通过html传递它,将其返回到我的详细信息刀片中。我使用Bootstrap-select v1.13.1

我的索引刀片...

 <div class="modal fade bd-example-modal-lg" id="mymodal" role="dialog" >
      <div class="modal-dialog modal-lg col-md-12" role="document">

          <div class="modal-content">
              <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                   <span aria-hidden="true">&times;</span>
                </button>
            </div>

            <div class="modal-body col-md-12  mt--4">
               <div class="defectcontainer"></div>
            </div>
     </div>
  </div>

我的剧本......

 $('#mymodal').on('shown.bs.modal',function(e){

         $.ajax({
             url:'{{{ URL::to("getdefectsdataJson") }}}',data:
             {
               'coordinate_id':$("#coordinate_id").val(),}
         }).done(function(defectdatahtml){
              $(".defectcontainer").html(defectdatahtml);         
         });
});

解决方法

感谢本文档https://github.com/snapappointments/bootstrap-select。我找到了问题的答案。 $('#mymodal')。on('shown.bs.modal',function(e){

     $.ajax({
                url:'{{{ URL::to("getdefectsdataJson") }}}',data:
                {
                'coordinate_id':$("#coordinate_id").val(),}
            }).done(function(defectdatahtml){

              $(".defectcontainer").html(defectdatahtml);

  //-------------  i add this funtion to my script. -------------------------------------------------//
  $('.selectpicker').selectpicker();
                
        });

});