【问题标题】:Bootstrap Select drop list moves down ward automaticallyBootstrap Select下拉列表自动向下移动
【发布时间】:2015-05-06 21:37:16
【问题描述】:

我是 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');

        }
    });

【问题讨论】:

  • 请创建一个工作示例来模拟您的问题。您可以使用:jsfiddle.net

标签: bootstrap-select


【解决方案1】:

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

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

删除此代码并添加此代码

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-12-27
    • 2014-03-01
    • 1970-01-01
    • 2014-05-22
    • 2015-08-11
    • 1970-01-01
    • 2015-03-28
    • 2012-09-22
    相关资源
    最近更新 更多