Jump to content

[SOLVED] Select WIDTH in IE


EagerWolf

Recommended Posts

<form id="form1" name="form1" method="post" action="">
  <label>
  <select name="select" style="width:150px">
    <option value="1">sdasdadasasdsasaddsaasdsa</option>
    <option value="2">sadasdasfasfasasfasfasf</option>
    <option value="3">asd</option>
  </select>
  </label>
</form>

If you put this in html file and open it with IE.. You will see, that values (sdasdadasasdsasaddsaasdsa) aren't shown correctly.. box with 150px width is opened when select is clicked... In other site Firefox shows it correctly...

 

IE won't show the entier text in the select menu width is smaller than the option, you need to use a script to resize the width to "auto" when the menu is open using onclick events. It's a bit complicated since you'll need to track if the user clicked on the menu to open it or to close it.

 

Something like this

 

When the user click on the menu, a click counter will recorde the click to 1 which means the menu is open.

 

If the counter is 1 set the width to auto

 

the user make a selection, set the counter to 0

 

if the counter is 0 set the width to 150

 

Things you need to worry about is if the user click outside the menu to close (you'll need an onclick event on the body)

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.