码迷,mamicode.com
首页 > 其他好文 > 详细

bootstrap select selectpicker动态赋值与赋默认值

时间:2021-02-15 12:19:35      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:str   ring   htm   key   comment   length   type   sele   html   

动态赋值

 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);

bootstrap select selectpicker动态赋值与赋默认值

标签:str   ring   htm   key   comment   length   type   sele   html   

原文地址:https://www.cnblogs.com/fuxp/p/14397653.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!