button type Attribute - HTML CSS HTML Tag

HTML CSS examples for HTML Tag:button

Description

The type attribute sets the type of button.

Attribute Values

Value Description
button The button is a clickable button
submit The button is a submit button (submits form-data)
reset The button is a reset button (resets the form-data to its initial values)

Two button elements that act as one submit button and one reset button (in a form):

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<form action="/action_page.php" method="get">
First name: <input type="text" name="fname"><br>
Last name: <input type="text" name="lname"><br>
<button type="submit" value="Submit">Submit</button>
<button type="reset" value="Reset">Reset</button>
</form><!--  ww  w.j  av  a 2 s.co  m-->

</body>
</html>

Related Tutorials