element
The most important form element is the element.
Elements can change into multiple forms according to different type attributes.
(Recommended learning: HTML Introduction Tutorial)
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>
Lists usually display the first option as the selected option.
You can define predefined options by adding the selected attribute.
Example
<option value="fiat" selected>Fiat</option>
Example
<textarea name="message" rows="10" cols="30"> The cat was playing in the garden. </textarea>
The above HTML code is displayed in the browser as:
The cat was playing in the garden.
Instance
<button type="button" onclick="alert('Hello World!')">Click Me!</button>
The above is the detailed content of HTML form elements. For more information, please follow other related articles on the PHP Chinese website!