Drop-down list in HTML

Drop-down list in HTML
 
Drop-down list in HTML
  • Currently 0 out of 5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Rating: 0/5 (0 votes cast)

Thank you for rating!

You have already rated this page, you can only rate it once!

Your rating has been changed, thanks for rating!

Log in or create a user account to rate this page.


Drop-down list is sometimes called pop-up menu, one of the flexible and convenient form elements. Depending on the list settings, you can select one or more values. The advantage of the list is its compact size, it takes up only one field, and to view the entire list one needs to click on it. However, this is at the same time its disadvantage, because the user does not immediately see all the options.

Drop down list is created as follows.

<select parameters>
  <option parameters> Choice 1</option>
  <option> Choice 2</option>
  <option> Choice 3</option>
</select>

Tags select and option have the following parameters (table 1).

Table 1. Drop-down list parameter.

Parameter
select

Description

name

Name of the field. Designed for the form handler to identify the list.

size

The number of visible items in the list. By default, one item.

multiple

This parameter allows to select multiple items in the list. The selection is made with keys Control or Shift.

Parameter
option

Description

selected

Displayed field by default.

value

This parameter specifies what will be sent to the server if certain item is selected.

How to create the list using tags select and option is shown in example 1.

Example 1. Drop-down list.

<form action="/cgi-bin/handler.cgi">
  <b>What do you think the abbreviation "OS" stands for?</b><br>
  <select name="OS">
    <option>Officer Standpoint</option>
    <option>Operating System</option>
    <option>Obese Singularity</option>
  </select>
</form>

The result is shown below.

What do you think the abbreviation "OS" stands for?

 

Read also

Adding a form to a page in HTML

Adding a form to a page in HTML

Text field in HTML

Text field in HTML

Buttons in HTML

Buttons in HTML

Form elements in HTML

Form elements in HTML

Post comment

basicuse.net
html5_css
106160485398655174790

Quick navigation

General navigation