In HTML, the value
attribute is applied to the input element. Its uses are as follows:
<input value="text">
This attribute takes text
as an argument. It represents the default value for the input element.
<html><head></head><body><div id="content"><label for="city">City:</label><!-- provide value attribute --><input id="city" type="text" value="Paris"></div></body></html>
In the example above, we take city
as the input from the user and assign its default value as Paris
. If the user doesn’t provide a value for city
while submitting the form, the default value is submitted.