bootstrap select動態賦值與賦默認值


動態賦值

 var str = '';
 for (var i = 0; i < response.data.id_with_codes.length; i++){
    str += '<option value="'+ response.data.id_with_codes[i][0] +'">'+ response.data.id_with_codes[i][1] +'</option>'
  }
  //    將動態拼接的數據渲染
  $('#waterfall-is-rules').html(str);
  //    刷新
  $('#waterfall-is-rules').selectpicker('refresh');

賦默認值

  $('#waterfall-is-rules').selectpicker('val', response.data.cash.entry_type);


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM