value (HTML attribute)

Depr. Version
Browser support (more…)
IE5.5+ FF1+ SA1.3+ OP9.2+ CH2+
Full Full Full Full Full




The value attribute is used and displayed differently depending on the type of form control to which it’s applied, as detailed below:
  • type = "button", "submit", "reset"

    The text stated in the value attribute is used as the button’s text, and can’t be changed by the user (although it could be changed dynamically via JavaScript).

  • type = "text", "password"

    The value will appear inside the form control and may be overtyped, copied, or cut by the user. Note that if it’s displayed in the password field, it will be obfuscated, but the correct number of characters will appear nonetheless.

  • type = "radio", "checkbox", "image", "hidden"

    The value won’t be displayed to the user, nor can it be changed, but it will be associated with the control, and it’s the value that’s passed on when the form is submitted.

Note that the properties chart doesn’t show the value attribute as being required for all input types, but in the case of radio and checkbox input types, value is required.


This code sets a predefined value of "Enter search phrase" for a text input:

<input type="text" name="search" value="Enter search phrase"/>


This attribute can take any name or value of the developer’s choosing.


Internet Explorer Firefox Safari Opera Chrome
5.5 6.0 7.0 8.0 1.0 1.5 2.0 3.0 3.5 1.3 2.0 3.1 4.0 9.2 9.5 10.0 2.0
Full Full Full Full Full Full Full Full Full Full Full Full Full Full Full Full Full

It causes no compatibility issues, and has excellent support across all tested browsers.

User-contributed notes

by lloydi
Wed, 04 Jun 2008 09:30:29 GMT

Digging around for this, I found some other people who have found the same problem. This page has some useful additional ifo:

Jukka Korpela writes:

"VALUE attribute, despite being syntactically valid, has no logical meaning in this context - note that it does not get transmitted in the form data set; but since some browsers use it, instead of ALT, for the alternative text, it is a good idea to include it too (with the same value as ALT)"

by lloydi
Wed, 04 Jun 2008 08:50:05 GMT

Oh dear. Author commenting on his own work!

I had a bug to fix today at work - a form was not submitting properly in IE and Opera. Looking at the server-side script, it was looking for a value of the submit button. However, the submit button - input type="submit" - had since been changed to an image - input type="image". The value attribute associated with that input was not being passed through upon submission, causing the server-side script to fail. This effect only occurred on IE (all versions) and Opera (tested in 9.26 only, what I had available).

With that in mind, I believe an extra paragraph stating the problem above needs to be added to the section about image type inputs, also the supprt matrix should be changed to partial (or buggy) for IE and Opera.

Related Products