how to change select2 value programmatically

后端 未结 4 1332
醉话见心
醉话见心 2021-01-17 07:13

I have a select2 box in bootstrap modal, I want to change the value of the select2 box but it didn\'t work.

I tried every single solution in previous posts and resul

4条回答
  •  太阳男子
    2021-01-17 07:49

    For Select2 with Ajax call, I struggled with lot of options, but none worked. Then i came to following solution, which works like charm $("#select_id").html($("").val('val').text('text')).trigger("change");

提交回复
热议问题