What are HTML form elements? __html

Source: Internet
Author: User
Tags button type html form

This chapter describes all HTML form elements. <input> Elements

The most important form element is the <input> element.

Depending on the type attribute, <input> elements can be changed into multiple forms.

Note: The next chapter explains all HTML input types. <select> elements (drop down list)

<select> element definition Drop-down list: instance

<select name= "Cars" >
<option value= "Volvo" >Volvo</option>
<option value= "Saab" > saab</option>
<option value= "Fiat" >Fiat</option>
<option value= "Audi" >audi</ Option>
</select>

The <option> element defines the options to be selected.

The list usually displays the first option as the selected option.

You can define predefined options by adding the selected property. instance

<option value= "Fiat" selected>fiat</option>

<textarea> Elements

<textarea> element defines multiple-line input fields (text fields): instance

<textarea name= "message" rows= "ten" cols= ">" The
cat was playing in the garden.
</textarea>

The above HTML code appears in the browser as:

The cat is playing in the garden.
<button> Elements

<button> element Definition clickable button: instance

<button type= "button" onclick= "alert (' Hello world! ')" >click me!</button>

The above HTML code appears in the browser as: Click me! HTML5 table cell element

HTML5 adds the following form elements: <datalist> <keygen> <output>

Note: By default, the browser does not display unknown elements. The new element will not corrupt your page. HTML5 <datalist> Elements

<datalist> element provides a list of predefined options for the <input> element.

Users will see a drop-down list of predefined options when they enter data.

The list property of the <input> element must reference the id attribute of the <datalist> element. instance

To set the <input> element of a predefined value by <datalist>:

<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>

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.