0

The title of this question speaks pretty much for itself.
Is it in any way possible to change the width of a DropdownBox to the width of the selected value?

I have searched quite some time on this matter and have not found a good solution so far.
Any help is much appreciated!

For instance with this code:

<select>
    <option value="volvo">Volvo</option>
    <option value="saab">Saab</option>
    <option value="mercedes">Mercedes</option>
    <option value="audi">Audi</option>
</select>

When you select for instance 'Volvo' the dropdown arrow is positioned based on the width of the longest value (see picture).

selected value

Can it be manipulated that the arrow moves right after the selected value?
Even when they all have variable widths.

Fiddle

Piyush Marvaniya
  • 2,496
  • 2
  • 16
  • 28
Filip Huysmans
  • 1,301
  • 1
  • 20
  • 44

0 Answers0