HTML <button> with type Attribute

You are Here:

HTML <button> with type Attribute

The type attribute specifies the type of the button.

Note: The button element will work without type attribute. But it is recommended to mention the type attribute because different browsers may use different default types for the <button> element.

button

Specifies that the button is dummy. You can use JavaScript to add functionality.

Example

HTML Online Editor
<!DOCTYPE html> <html> <body> <form action="/user-name.php" method="get"> Name: <input type="text" name="name"> <button type="button">Button</button> </form> </body> </html>

Attribute Value

ValueExplanation
buttonSpecifies that the button is dummy.
resetSpecifies that the form-data will reset to its default value when clicked.
submitSpecifies that the form-data will be submited to the specific URL when clicked.

reset

Specifies that the form-data will reset to its default value when clicked.

Example

HTML Online Editor
<!DOCTYPE html> <html> <body> <form action="/user-name.php" method="get"> Name: <input type="text" name="name"> Age: <input type="text" name="age" value="35"> <button type="reset">Reset</button> </form> </body> </html>

submit

Specifies that the form-data will be submited to the specific URL when clicked.

Example

HTML Online Editor
<!DOCTYPE html> <html> <body> <form action="/user-name.php" method="get"> Name: <input type="text" name="name"> <button type="submit">Submit</button> </form> </body> </html>

Reminder

Hi Developers, we almost covered 99.5% of HTML Tutorials with examples for quick and easy learning.

We are working to cover every Single Concept in HTML.

Please do google search for:

Join Our Channel

Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.

This channel is primarily useful for Full Stack Web Developer.

Share this Page

Meet the Author