HTML for attribute
for attribute associates the input control with the label element. It makes a relationship between the output of calculation and the numbers that involve in the calculation.
<form action="files/for.php" method="post">
<label for="fn">Name: </label><input id="fn"><br>
<label for="age">Age: </label><input min=0 id="age"><br>
<label for="pc">Postal code: </label><input id="pc">
<input type="submit" name="submit">
</form>
</>
Attribute values
All possible values of accept attributeThe value of for attribute is plain text.
Related Tags
The tags that support accept attribute<label> tag
-
label tag defines a caption for the input control as in the above example.
The caption is associated with input field using the for attribute in the label element
<output> tag
-
output element represents the calculated value of the numbers in input fields.
In case of the output element, the value of 'for' attribute is unique space separated tokens. These tokens include the values of name attributes of the input elements.
-
<form oninput="div.value = x.valueAsNumber + y.valueAsNumber"> <input name=p type=number >+ <input name=q type=number > = <output name=div for="p q"></output> </form>
Try</> -
In the above example the for attribute contains the values of name attributes of input elements that are separated by space.
Next Previous
Was this article helpful?