Bootstrap Select下拉列表自动向下移动

时间:2015-03-05 13:39:42

标签: bootstrap-select

我是IE11中的Bootstrap Select用户。

当我用ajax填充数据并打开它然后它自动向下移动病房,当我选择任何值时,它没有被选中。如何删除此错误?

jQuery.ajax({
        url: base_url + "UserBusinesses/ajaxState/" + countryId,
        dataType: 'json',
        beforeSend: function () {
            $('#UserBusinessStateId').html('<option value="">Loding... </option>');
            $('#UserBusinessStateId').selectpicker('refresh');
            $('#UserBusinessCityId').html('<option value="">Select city</option>');
            $('#UserBusinessCityId').selectpicker('refresh');
        },
        success: function (obj) {
            var addHtml = '';
            addHtml += '<option value="">Select state</option>';
            $.each(obj, function (key, value) {
                var selected = "";
                if (selectedState == key) {
                    var selected = "selected='selected'";
                }
                addHtml += "<option value='" + key + "' " + selected + ">" + value + "</option>";
            });
            jQuery("#UserBusinessStateId").html(addHtml);

            $('#UserBusinessStateId').selectpicker('refresh');

        }
    });

1 个答案:

答案 0 :(得分:14)

我正面临这个问题在IE中,我找到了解决方案

 $('#UserBusinessStateId').selectpicker('refresh');

删除此内容并添加此代码

$('#UserBusinessStateId').selectpicker('render').selectpicker('refresh');