2017-05-29 190 views
1

波紋管是我的代碼我想要多個選擇與下拉和複選框,當我在選擇標記中使用多個屬性正在生成列表類型的視圖,我不希望所以請幫助我 我想出就把它顯示在這個網址http://demo.itsolutionstuff.com/demo/demo-bootstrap-jquery-multiple-select-with-checkboxes-example-using-bootstrap-multiselectjs-pluginexample.html 但它並不在我的項目工作,我使用笨框架多個選擇與下拉

<div class="col-md-4 col-sm-6"> 
    <div class="form-group">        
     <label for="LS_name">Loan/Scholarship</label> 
         <?php 
         $LSList = []; 
         if(isset($_REQUEST['LS_name'])){ 
          $LSList = $_REQUEST['LS_name']; 
         } 
         ?> 
         <select class="form-control" name="LS_name[]" id="languages"> 
          <?php foreach($LS_List as $key => $value){ ?> 
           <option value="<?php echo $value['name']; ?>" <?php if(in_array($value['name'], $LSList)){ ?>selected="selected"<?php } ?>><?php echo $value['name']; ?></option><?php 
          } ?> 
         </select> 
        </div>  
       </div> 

,我使用這個腳本

<script src="<?php echo base_url(); ?>assets/js/jquery-1.11.2.min.js"> 
    </script> 
<script src="<?php echo base_url(); ?>assets/js/bootstrap-multiselect.js"> 
</script> 
<script src="<?php echo base_url(); ?>assets/js/bootstrap.min.js"></script> 
<script type="text/javascript"> 
$(document).ready(function() { 
    $('#languages').multiselect({ 
    includeSelectAllOption: true 
    }); 
}); 
+0

道道ü請正確格式化的問題嗎? –

+0

我編輯我的問題,所以請幫助我 – Mahantesh

回答

0

我覺得multiselect.js的Jquery PL就像你使用

做這樣

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/multi-select/0.9.12/css/multi-select.min.css"> 
<a href='#' id='select-all'>select all</a> 
<a href='#' id='deselect-all'>deselect all</a> 
<select multiple="multiple" id="my-select" name="my-select[]"> 
     <option value='elem_1'>elem 1</option> 
     <option value='elem_2'>elem 2</option> 
     <option value='elem_3'>elem 3</option> 
     <option value='elem_4'>elem 4</option> 
     <option value='elem_100'>elem 100</option> 
    </select> 
    <script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.min.js"></script> 
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/multi-select/0.9.12/js/jquery.multi-select.min.js"></script> 
<script type="text/javascript"> 
    $(document).ready(function() { 
     $('#my-select').multiSelect(); 
     $('#select-all').click(function(){ 
      $('#my-select').multiSelect('select_all'); 
      return false; 
     }); 
     $('#deselect-all').click(function(){ 
      $('#my-select').multiSelect('deselect_all'); 
      return false; 
     }); 
    }); 

</script> 

Demo烏金不能提供includeSelectAllOption選項這裏

希望它會幫助你

+0

謝謝,這不是沒有問題,也沒有它只是給列表類型的輸出..我想下拉列表多選擇,我也有多選擇插件... – Mahantesh