0

I have a drop down in a form and it needs to be restricted to 400 pixels in width, but some of the options are much longer. Is there a way to expand the drop down after you click it that also works in IE...possibly a JS solution?

Mark
  • 1
  • 1
    I think your problem is already solved here: [Dropdownlist width in IE](http://stackoverflow.com/questions/73960/dropdownlist-width-in-ie) (marked as duplicate) – Nicole May 12 '11 at 17:44

2 Answers2

0

Yes sure try this

<select name="expand" id="expand" onclick="expand(this);">...</select>

Note that the above html is just a snippet, you need to complete it to suit you

Javascript

<script type="text/javascript">
function expand(obj)
{
    obj.style.width = "450px"; //any value wider than OR
    //obj.style.width = "auto"; //to automatically take length of it values
}
</script>
boug
  • 1,859
  • 1
  • 13
  • 13
0

There is also a simple jQuery solution:

<select name="expand" id="expand" onclick="$(this).width('450px');">...</select> 
Luc125
  • 5,752
  • 34
  • 35