Bootstrap Select drop list moves down ward automatically

ⅰ亾dé卋堺 提交于 2019-11-29 02:54:09

问题


I am Bootstrap Select user in IE11.

When I fill data with ajax and open it then it automatically move down wards and when I select any value then it's not selected. How can I remove this error?

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:


I am facing this issue In IE and I have find the solution

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

remove this and add this code

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


来源:https://stackoverflow.com/questions/28879182/bootstrap-select-drop-list-moves-down-ward-automatically

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!