Multiple select

5 pts.
Tags:
ComboBox
Development
JavaScript
Select object
My application has a screen with a multiple select object. I have javascript that dynamically selects items in the object based on user input. My question is: how can I force the select object to show the first selected object in the select object's display window. I've been successful with a select box that allows only one selection but cannot seem to do it with a multiple select box. I've included an example below where item 5 is selected. The selected item does not show in the select box's window though and I don't know how to force it. Thanks for any help. <select name="selectme" multiple size="3"> <option>dog <option>cat <option>giraffe <option>elephant <option selected>tiger </select>

Answer Wiki

Thanks. We'll let you know when a new response is added.

Hello Nimamuth,

the code below works as desired.

<pre>
<html>
<head>
<SCRIPT>
function scrollToLast(select) {
select.multiple=true;
}
</SCRIPT>
</head>
<body>
<select id=”selectme” multiple=”multiple” size=”3″ onload=”scrollToLast(this)”>
<option>dog</option>
<option>cat</option>
<option>giraffe</option>
<option>elephant</option>
<option selected=”selected”>tiger</option>
</select>
</body>
</html>
</pre>

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following