HTML CSS examples for HTML Tag:input
The submit, reset, and button types of input element create buttons that are very similar to those created when using the button element.
The input Element Types That Create Buttons
Type | Description | Additional Attributes |
---|---|---|
submit | Creates a button that submits the form. | formaction, formenctype, formmethod, formtarget, formnovalidate |
reset | Creates a button that resets the form. | None |
button | Creates a button that performs no action. | None |
The following code shows how to use the input Element to Create Buttons.
<!DOCTYPE html> <html> <head> <title>Example</title> </head> <body> <form method="post" action="http://example.com/form"> <p> <label for="name"> Name: <!--from www.j a va 2 s .c o m--> <input value="java2s.com" 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"> Fruit: <input value="CSS" 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>