- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
HTML
The type attribute of the <button> element is used to set type of the button. Following is the syntax −
<button type="button|submit|reset">
Above, we have shown the different types set for the button element i.e.: submit −
- button: A clickable button
- submit: Submit button (submits form-data)
- reset: It is a reset button to reset it to the initial value.
Let us now see an example to implement the type attribute of the button element in HTML −
Example
<!DOCTYPE html> <html> <body> <h2>Investor Information</h2> <p>Give the information about the investor interested in funding:</p> <form action="" method="get"> ID: <input type="number"><br> Investor: <input type="text"><br> Funds: <input type="number"><br> Email: <input type="email"><br> DOB: <input type="date"><br><br> <button type="submit" value="Submit">Submit</button> <button type="reset" value="Reset">Reset</button> </form> </body> </html>
This will produce the following output with submit and reset button −
In the above example, we have created a form with form elements and buttons −
<form action="" method="get"> ID: <input type="number"><br> Investor: <input type="text"><br> Funds: <input type="number"><br> Email: <input type="email"><br> DOB: <input type="date"><br><br> <button type="submit" value="Submit">Submit</button> <button type="reset" value="Reset">Reset</button> </form>
The buttons type we have set to create a submit as well another button, which would be for reset −
<button type="submit" value="Submit"> Submit </button> <button type="reset" value="Reset"> Reset </button>
Advertisements