Definition and Usage The value attribute is used differently for different input types. For type "text", "password" and...
Definition and Usage
The value attribute is used differently for different input types.For type "text", "password" and "hidden": Specifies the initial (default) value of the input field.
For type "button", "submit" and "reset": Specifies the text displayed on the button.
For type "checkbox", "radio" and "image": Specifies the value associated with the input. This is the value sent to the form's action URL.
Note: Cannot be used with type="file"
Note: This attribute is required with type="checkbox" and type="radio"
Syntax
<input value="input_value" /> |
Syntax Example
<input value="Harry" /> |
Attribute Values
Value | Description |
---|---|
input_value | Specifies value of the input element. |
Browser Support
The attribute is supported in all major browsers.Example
<form action=""> <input type="text" name="demo" value="Harry" /> </form> |