Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML Select options width is cropped in IE. Any solutions?

In Mozilla and non-IE browsers, if the option of select list is of a greater length than the select's width, it will show up. But in IE, it will crop the option up to the select's width.

Is there any way to make IE's select behaviour to be like that of non-IE browsers?

like image 551
Shyju Avatar asked Jun 19 '09 12:06

Shyju


2 Answers

This seems to work well in forcing IE to reevaluate the select width. Works in IE7 and IE8.

if (jQuery.browser.msie) {
    jQuery("#" + selectID).css("width", "100%").css('width', 'auto');
}
like image 129
peter Avatar answered Sep 29 '22 15:09

peter


css:

.set_width { width:120px; }

html:

<select class="set_width"><option>one</option><option>two</option></select>
like image 41
Steve Mallory Avatar answered Sep 29 '22 14:09

Steve Mallory