Tuesday, 6 August 2013

How to make the select element the width of its current option

How to make the select element the width of its current option

I'm creating a form and need the select element to expand/contract to the
width of its current option. Its current width is its longest option.
CSS can only be used to give the select a fixed width and using the jQuery
.width() function on an option returns 0px.

No comments:

Post a Comment