Bootstrap Select - reinitialize on dynamically added element

后端 未结 2 1058
傲寒
傲寒 2021-02-07 01:13

I\'m using Bootstrap Select (http://silviomoreto.github.io/bootstrap-select/) for displaying dropdown with Font-Awesome icons for each section of my website.

I added abi

2条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-07 01:30

    refresh()

    To programmatically update a select with JavaScript, first manipulate the select, then use the refresh method to update the UI to match the new state. This is necessary when removing or adding options, or when disabling/enabling a select via JavaScript.

    $(".selectpicker").selectpicker('refresh');
    

    Demo

提交回复
热议问题