HTML <input> Tag with the 'type' Attribute
<form name="myForm" action="/resources/html-forms-action.cfm">
<input value="Your text..." name="myField">
<button>Submit</button>
</form>
The above example demonstrates usage of the <input>
element with the value
attribute.
The value
attribute allows you to provide the default value of the <input>
element.
The value
attribute is optional — you can choose to include it or not. If it's included, you should ensure that the value doesn't violate any constraints that are implemented against the input control (such as validation constraints). For example, if an input control of type number
can accept a max
value of say, 10, don't set the default value to 11.
Also, don't use the value
attribute to display placeholder text. To display placeholder text, use the placeholder
attribute.