hi all,

I have done one work in using multiple select box in which i am fetching value of select boxes from database. This all work i have done using ajax. Like when we select country form first select box then it will show state comes under country. But now problem is that when i am selecting country form first select box then 2nd select box which is for state. This is dyanmically changes size . Sometimes it becomes large and sometime it is very short in size. Because value are changing dynamically . So i want now that size should be fixed of 2nd select box.

IS there any way in html code in which we can fix the size of 2nd select box or we can fix the larges size which it can be ?? how i can set this fix size?????

Please help me to solve this issue.
Thanks,
Gagan

Recommended Answers

All 3 Replies

Try to apply this with your select element:

<select id="sel" name="sel" style="min-width: 300px; max-width: 300px; width : 300px;" size="1">

you can do the same thing with height.

Just remember that this will be tiny on some screens, and huge on others.

set before you populate the select box put a value in it equal to the largest expected size, in the code below function populate is not defined, I figure you have yours already written, and my javascript isnt good enough

<select id='country' onchange='populate("nextselect");'>
<option> Select </option>
<option value='appleland'>appleland</option>
<option value='bananaland'>bananaland</option>
<option value='carrotland'>carrotland</option>
</select>
<select id='nextselect'>
<option value=""> --------------- </option></select>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.