W3Schools.com

HTML <input> value Attribute

HTML input Tag Reference HTML <input> tag

Example

An HTML form with initial (default) values:

<form action="form_action.asp">
  First name: <input type="text" name="fname" value="John" /><br />
  Last name: <input type="text" name="lname" value="Doe" /><br />
  <input type="submit" value="Submit form" />
</form>

Try it yourself »

Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The value attribute is supported in all major browsers.


Definition and Usage

The value attribute specifies the value of an <input> element.

The value attribute is used differently for different input types:

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

Note: The value attribute is required with <input type="checkbox"> and <input type="radio">.

Note: The value attribute cannot be used with <input type="file">.


Syntax

<input value="text" />

Attribute Values

Value Description
text Specifies the value of the <input> element


HTML input Tag Reference HTML <input> tag
WEB HOSTING
Best Web Hosting
PHP MySQL Hosting
Best Hosting Coupons
UK Reseller Hosting
Cloud Hosting
Top Web Hosting
$3.98 Unlimited Hosting
Premium Website Design
WEB BUILDING
Download XML Editor
FREE Website BUILDER
Best Website Templates Top CSS Templates
CREATE HTML Websites
EASY WEBSITE BUILDER
W3SCHOOLS EXAMS
Get Certified in:
HTML, CSS, JavaScript, XML, PHP, and ASP
W3SCHOOLS BOOKS
New Books:
HTML, CSS
JavaScript, and Ajax
STATISTICS
Browser Statistics
Browser OS
Browser Display
SHARE THIS PAGE