Using the input Element to Create Buttons
The submit, reset, and button types of input element create buttons that are very similar to those created when using the button element.
Type | Description | Additional Attributes |
---|---|---|
submit | Creates a submit button. | formaction, formenctype, formmethod, formtarget, formnovalidate |
reset | Creates a button that resets the form. | None |
button | Creates a button that performs no action. | None |
The label that on the button is taken from the value attribute.
<!DOCTYPE HTML>
<html>
<head>
<title>Example</title>
</head>
<body>
<form method="post" action="http://yourServer/form">
<p>
<label for="name"> Name:
<input value="Adam" id="name" name="name" />
</label>
</p>
<p>
<label for="password"> Password:
<input type="password" placeholder="Min 6 characters" id="password" name="password" />
</label>
</p>
<p>
<label for="fave"> Choice:
<input value="Apples" id="fave" name="fave" />
</label>
</p>
<input type="submit" value="Submit Vote" />
<input type="reset" value="Reset Form" />
<input type="button" value="My Button" />
</form>
</body>
</html>
Home
HTML CSS Book
HTML
HTML CSS Book
HTML
input:
- <input> element
- input element max size
- input text field size
- input text field initial value
- input text field placeholders(gray text)
- Using a Data List
- Read-Only input text field
- Disabled Text Boxes
- input element for password input
- Using the input Element to Create Buttons
Related: