The value attribute

value sets an element's value — initial text for input, an option's value, a number for progress/meter.

Applies to

input, option, li, progress, meter, button, data

Values

Depends on the element: a string for input/option, a number for li (in ol), progress, meter.

Example

<input type="text" value="Default value">
<option value="ua">Ukraine</option>

Edge cases

  • For input, value only sets the INITIAL value in HTML — after user interaction, the real current value is read via the JS .value property, not the attribute.
  • For checkbox/radio, value defines what gets submitted when checked, not the checked state itself (that's the checked attribute).

Related tools