bootstrap-select 下拉多选 重置刷新下拉选项

js中其他事件相关的代码中,使用jquery通过控件id设置selectpicker属性值为refresh进行重置刷新

    function doReset() {
        //对id为elementID的下拉框进行重置刷新
        $("#elementID").selectpicker('refresh');
    }

 

或者: 参考 https://blog.csdn.net/lldd2014425/article/details/73482977/

    function doReset() {
            //对id为elementID的下拉框进行重置刷新
            document.getElementById("elementID").options.selectedIndex = 0; //回到初始状态  options.selectedIndex是原生js才有的属性,jquery是没有的,所以这里不用$("#elementID")
            $("#elementID").selectpicker('refresh');//对searchPayState这个下拉框进行重置刷新
        }

 

你可能感兴趣的:(bootstrap,HTML)