HTML <input> value Attribute

Definition and Usage

value The property specifies the value of the <input> element.

For different input types,value The usage of properties is also different:

  • For "button", "reset", and "submit" - it defines the text displayed on the button
  • For "text", "password", and "hidden" - it defines the initial (default) value of the input field
  • For "checkbox", "radio", and "image" - it defines the value associated with the input (which is also the value sent when submitted)

Attention:value Attributes cannot be used with <input type="file"> Used together.

Example

HTML form with initial (default) values:

<form action="/action_page.php">
  <label for="fname">Name:</label>
  <input type="text" id="fname" name="fname" value="Bill"><br><br>
  <label for="lname">Surname:</label>
  <input type="text" id="lname" name="lname" value="Gates"><br><br>
  <input type="submit" value="Submit">
</form>

Try It Yourself

Syntax

<input value="text">

Attribute Value

Value Description
text Specify the value of the <input> element.

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support