Button input (type="button")

HTML Living Standard

Creates a push button with no built-in form action. Add JavaScript for the behavior you want.

On this page

Attributes and behavior

Value or syntaxWhat it does
value="Show room"Sets the label shown on the button.
disabledPrevents interaction while present.

Try the example

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Button input</title>
  <style>
form { display: grid; gap: 12px; justify-items: start; } output { display: block; margin-top: 10px; }
  </style>
</head>
<body>
<input type="button" value="Show room" onclick="room.value = 'Room 2'">
<output id="room"></output>
</body>
</html>

What to expect Click Show room to update the text through JavaScript.

Official references