0

I have a html dropdown. Values are multi selected, i want, user only able to select one value at a time

<select name="selectto" id="ddlQuestionList" multiple="multiple"> <option></option> </select> 

dropdown with multiple selection

this happening when removing that multiple='multiple' attribute. i want like first image. Not like second one with dropdown

3 Answers 3

2

Simply

remove multiple="multiple" from the tag and add size=10 or whatever size you like (Y)

Demo http://jsfiddle.net/x3cfb/

Sign up to request clarification or add additional context in comments.

3 Comments

if i will remove this attribute multiple=multiple. then, i will not able to make dropdown like a textarea wide. As you can see in image, that is a dropdown. user don't want to click again and again on dropdown.
thank you for your help, and i also have to add overflow:scroll. so that, it will not extend more in height, on increasing of value.
@wikijames use maximum height in css #ddlQuestionList{ max-height:100px; } jsfiddle.net/x3cfb/3
2

Remove the multiple attribute:

<select name="selectto " id="ddlQuestionList"> 

Boolean attributes are false if they are not included, true if they appear at all <select multiple> and true if you use the full XML style syntax <select multiple="multiple">

3 Comments

If, however, you are using the multiple attribute so it appears as a list, you need to use size="7" or such instead.
Technically, you don't have to as you can multi-select from a drop-down, but from a usability point of view it is much easier - so +1 for using the size attribute.
thanks allot, i also have to add overflow:scroll. so that, it will not extend more in height, on increasing of value.
0

Remove the multiple attribute, like so:

<select name="selectto" id="ddlQuestionList"> <option></option> </select> 

Comments