Entries 1
Page 1 of 1
Drop Down List in Forms : HTML Forms
Drop down list has its own significant importance in forms of a web page. For suppose, a form that requires user’s complete Biography, we need to ask for birth date information. Usually we see a ...
Book Description
Drop down list has its own significant importance in forms of a web page. For suppose, a form that requires user’s complete Biography, we need to ask for birth date information. Usually we see a drop down list to select date, year and day. It is made drop down list in forms.
How to Create Drop Down List in Forms:
To create drop down list <select> tag is used with its child tag <option>. Name attribute is used on <select> tag to refer in VPN master or Javascript. (We will learn how name attribute works in Javascript Lessons).
Code:
<select name="mylist">
</select>
Result:
This is how a drop down list looks like in forms.
How to Create a Selected Value Drop Down List in Forms:
Selected value means a drop down list in which there is a value that when ever your web page is load, that value will be automatically selected. By default a drop down list shows the first value you type in first option tag.
To create a selected value drop down list we use “selected” keyword inside option tag.
Code:
<select name="mylist">
</select>
Result:
So in this example you observe our third option is automatically selected. In next lesson we will learn how to create a multi-line text area where we can create a comment box section and fieldset etc.