HTML Select and option tags

Source: Internet
Author: User

1. SelectElements

The Select element creates a single-or multiple-selection menu. The <option> tag in the <select> element is used to define the available options in the list

Common properties are as follows:

Autofocus: Specifies that the text area automatically receives focus after the page is loaded.

Disabled: Specifies that the drop-down list is disabled.

Form: Specifies one or more forms to which the text area belongs.

Multiple: Specifies that multiple options can be selected.

Name: Specifies the names of the drop-down lists.

Required: Specifies that the text area is required.

Size: Specifies the number of visible options in the drop-down list.

2. Option element

The option element defines one of the options in the drop-down list (an entry). The browser displays the contents of the <option> tag as a menu of <select> tags or as an element in a scrolling list. The option element is inside a SELECT element.

Note:<option> tags can be used without any attributes, but you typically need to use the Value property, which indicates what is sent to the server. Use this tag in conjunction with the SELECT element, otherwise this tag is meaningless. If the list options are numerous, you can use the <optgroup> tab to group related options.

Common properties are as follows:

Disabled: Specifies that this option should be disabled on first load.

Label: Defines the label used when <optgroup> is used.

Selected: Specifies that the option (when first displayed in the list) appears selected.

Value: Defines the option value to send to the server.

<Select>  <optionvalue= "Volvo">Volvo</option>  <optionvalue= "Saab">Saab</option>  <optionvalue= "Opel">Opel</option>  <optionvalue= "Audi">Audi</option></Select>

HTML Select and option tags

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.