HTTML Form Elements
HTTML Form Elements
html
The <input> element can be displayed in several ways, depending on the typeattribute.
Example
If the type attribute is omitted, the input field gets the default type: "text".
All the different input types are covered in the next chapter.
Example
<select name="cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="fiat">Fiat</option>
<option value="audi">Audi</option>
</select>
Try it Yourself »
Example
Visible Values:
file:///C:/Users/Rocky/Irfanview/Irfanview-Coding-Playground/listset/dayframe.html 2/9
9/5/2019 dayframe.html
Example
Use the multiple attribute to allow the user to select more than one value:
Example
Example
The rows attribute specifies the visible number of lines in a text area.
You can also define the size of the text area by using CSS:
Example
file:///C:/Users/Rocky/Irfanview/Irfanview-Coding-Playground/listset/dayframe.html 4/9
9/5/2019 dayframe.html
Try it Yourself »
Example
Click Me!
Note: Always specify the type attribute for the button element. Different browsers may use different
default types for the button element.
<datalist>
<output>
file:///C:/Users/Rocky/Irfanview/Irfanview-Coding-Playground/listset/dayframe.html 5/9
9/5/2019 dayframe.html
Note: Browsers do not display unknown elements. New elements that are not supported in older
browsers will not "destroy" your web page.
Users will see a drop-down list of the pre-defined options as they input data.
The list attribute of the <input> element, must refer to the id attribute of the <datalist> element.
Example
<form action="/action_page.php">
<input list="browsers">
<datalist id="browsers">
<option value="Internet Explorer">
<option value="Firefox">
<option value="Chrome">
<option value="Opera">
<option value="Safari">
</datalist>
</form>
Try it Yourself »
file:///C:/Users/Rocky/Irfanview/Irfanview-Coding-Playground/listset/dayframe.html 6/9
9/5/2019 dayframe.html
Example
<form action="/action_page.php"
oninput="x.value=parseInt(a.value)+parseInt(b.value)">
0
<input type="range" id="a" name="a" value="50">
100 +
<input type="number" id="b" name="b" value="50">
=
<output name="x" for="a b"></output>
<br><br>
<input type="submit">
</form>
Try it Yourself »
HTML Exercises
file:///C:/Users/Rocky/Irfanview/Irfanview-Coding-Playground/listset/dayframe.html 7/9
9/5/2019 dayframe.html
Exercise:
In the form below, add an empty drop down list with the name "cars".
<form action="/action_page.php">
< >
</ >
</form>
Submit Answer »
For a complete list of all available HTML tags, visit our HTML Tag Reference.
❮ Previous Next ❯
file:///C:/Users/Rocky/Irfanview/Irfanview-Coding-Playground/listset/dayframe.html 9/9