Software, your way.
How To Get Good Custom Software
(Download)
(PDF)
burger menu icon
WillMaster

WillMaster > LibraryManaging Website Forms

FREE! Coding tips, tricks, and treasures.

Possibilities weekly ezine

Get the weekly email website developers read:

 

Your email address

name@example.com
YES! Send Possibilities every week!

Multi-Select Scrolling List Box

The HTML select tag provides two different ways to present a list of selections.

One is a dropdown list where one item can be selected. The other is a scrolling list where multiple items can be selected.

They are coded very similar.

Let's start with a dropdown list. Then add the attributes that convert the dropdown list into a multi-select scrolling list box.

Here is a dropdown list example followed by the code that creates it.

This is the code to create the dropdown list:

<select name="example">
<option>One</option>
<option>Two</option>
<option>Three</option>
<option>Four</option>
<option>Five</option>
<option>Six</option>
<option>Seven</option>
</select>

The above dropdown list code can be converted into a multi-select scrolling box by adding two attributes. One is the multiple attribute and the other is the size attribute.

Here is an example multi-select converted from the above dropdown.

Here is the code for the multi-select scrolling box. Comments are below the code.

<select name="example" multiple size="3">
<option>One</option>
<option>Two</option>
<option>Three</option>
<option>Four</option>
<option>Five</option>
<option>Six</option>
<option>Seven</option>
</select>

The multiple attribute is a boolean (needs no value, just presence) — when present, multiple items may be selected; otherwise only one may be selected. When multiple is specified, most browsers will show a scrolling list box instead of a dropdown.

The size="3" attribute instructs the browser to make 3 of the list visible. The number may be changed. Use size="5" to show 5 list items, for example. When the number of list items is more than the number of visible items, the list may be scrolled. If no size attribute is provided, most browsers assume no list items shall be shown.

The switch is simple. Add 2 attributes to change a dropdown list into a multi-select scrolling list box.

  1. The boolean multiple attribute.
  2. The size attribute with a value indicating how many list items to show.

A multi-select scrolling box can be used on a web page whenever multiple items may be selected.

(This content first appeared in Possibilities newsletter.)

Will Bontrager

Was this article helpful to you?
(anonymous form)

Support This Website

Some of our support is from people like you who see the value of all that's offered for FREE at this website.

"Yes, let me contribute."

Amount (USD):

Tap to Choose
Contribution
Method

All information in WillMaster Library articles is presented AS-IS.

We only suggest and recommend what we believe is of value. As remuneration for the time and research involved to provide quality links, we generally use affiliate links when we can. Whenever we link to something not our own, you should assume they are affiliate links or that we benefit in some way.

How Can We Help You? balloons
How Can We Help You?
bullet Custom Programming
bullet Ready-Made Software
bullet Technical Support
bullet Possibilities Newsletter
bullet Website "How-To" Info
bullet Useful Information List
software index page

© 1998-2001 William and Mari Bontrager
© 2001-2011 Bontrager Connection, LLC
© 2011-2024 Will Bontrager Software LLC