HTML <button> typ Atribut

❮ HTML tag <button>

Příklad

Dva prvky tlačítka, které fungují jako jedno tlačítko pro odeslání a jedno tlačítko pro reset (ve formuláři):

<form action="/action_page.php" method="get">
  <label for="fname">First name:</label>
  <input type="text" id="fname" name="fname"><br><br>
  <label for="lname">Last name:</label>
  <input type="text" id="lname" name="lname"><br><br>
  <button type="submit" value="Submit">Submit</button>
  <button type="reset" value="Reset">Reset</button>
</form>

Definice a použití

Atribut typeurčuje typ tlačítka.

Tip: Vždy zadejte atribut type pro <button>prvek. <button>Různé prohlížeče mohou pro prvek používat různé výchozí typy .


Podpora prohlížeče

Attribute
type Yes Yes Yes Yes Yes

Syntax

<button type="button|submit|reset">

Hodnoty atributů

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)

❮ HTML tag <button>