IE7 select box shrinking – workaround

· Bugs, IE7
Authors

Apparently this is a known issue

The workaround, as mentioned here works, except that you might want to apply only for IE7 (could be hundreds of dynamic entries)

The googled solution for detecting IE7 with jquery is obsolete, since jQuery obsoleted the browser element. They suggest working with feature detection or modernizr, but if you only need to detect IE7 – that’s an overkill

Here’s the complete solution:

//After removing options elements:

$(“#my_select”).css(“width”,”1px”);

//After adding select options dynamically:

$(“#my_select”).css(“width”,”my_original_style”);

//Detect IE7 simply with regex:

var bIsIE7 = navigator.userAgent.match(/MSIE 7/);

 

That’s it 🙂

 

1 Comment

Comments RSS

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: