<select> only shows first char of selected option

前端 未结 7 946
予麋鹿
予麋鹿 2020-12-01 02:08

I have a standard select box which I\'m populating using jquery by appending options, but for some reason IE9 only shows the first character of the selected option. Needless

7条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-01 02:44

    Based on Jim's answer, I pass the drop-down list into this method:

    // force redraw to get around bug in IE.
    // NOTE that this removes width from the style attribute.
    function forceRedraw(jqueryObject) {
        jqueryObject.css('width', 0);
        jqueryObject.css('width', '');  // remove from style tag
    }
    

    This works around the bug in IE, and leaves the width of the element where it was before the method was called as long as the width is specified in CSS, not in the style attribute.

提交回复
热议问题