assign width to a select element
-
hi i have a select element that is created by javascript code and its options come from db. it works fine, but the problem is that the select element stretches itself to fit the longest option. and doesn't accept the width i specify/assign for it. what should i do?
-
hi i have a select element that is created by javascript code and its options come from db. it works fine, but the problem is that the select element stretches itself to fit the longest option. and doesn't accept the width i specify/assign for it. what should i do?
Did you try setting the width using inline style? Add
style="width: 100px;"
to the select element tag and try
-
Did you try setting the width using inline style? Add
style="width: 100px;"
to the select element tag and try
-
of course i did. but it has no effect on the width of select element since it stretches itself to fit the longest option. i set the width 100px, and when i inspect it in the browser, it is 400px!!!
can you please share the code of your select statement with us?