Bootstrap Select - reinitialize on dynamically added element

后端 未结 2 1057
傲寒
傲寒 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:28

    You have to refresh your select as mentioned on the plugin page

    $(select).selectpicker('refresh');
    
    0 讨论(0)
  • 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

    0 讨论(0)
提交回复
热议问题