• Have Any Question?
  • contact@eitworld.com

Html combobox controls





    • The combo box is a drop down list box . When we click on the arrow button on its right , it will display the list containing the items .
    • Combobox is also know as the Selectbox or drop down box .

Syntax:

<select name=”combo_box_name”>
<option>Option1</option>
<option>Option2</option>
: : : : : : : : : :
<option>Optionn</option></select>

 

  • Here is an example of combobox control which will show the several colors in the list from which you can choose one:

Example

<!DOCTYPE html>
<html>
<body>
<form >
Color :
<select name=”cbocolor”>
<option>Red</option>
<option>Blue</option>
<option>Green</option>
<option>Black</option>
</select>
</form>
</body>
</html>

To see live output : Visit Try Yourself Editor

Output

Attributes

Here is the list of Attributes for <select> tag:

Attribute Description
name (Optional) It is important as the control will be identified in the other file or server by the value of this attribute.
size (Optional) This can be used to present a scrolling list box.
multiple (Optional) If set to “multiple” then allows a user to select multiple items from the menu.

 

Here is the list of Attributes for <option> tag:

Attribute Description
value (Optional) The value that will be used if an option in the select box box is selected.
selected (Optional) This attribute specifies that this option should be the initially selected value when the page loads.
label (Optional) This is an alternative way of labeling options.

 



Real Time Web Analytics