Horje
What is HTML for Attribute

Definition and Usage

When used together with the <label> element, the for attribute specifies which form element a label is bound to.

When used together with the <output> element, the for attribute specifies the relationship between the result of the calculation, and the elements used in the calculation.


Applies to

The for attribute can be used on the following elements:

Elements Attribute
<label> for
<output> for


How to add Three radio buttons with labels

The label element. Click on one of the text labels to toggle the related radio button.
index.html
Example: HTML
<!DOCTYPE html>
<html>
<body>

<h1>The label element</h1>

<p>Click on one of the text labels to toggle the related radio button:</p>

<form action="/action_page.php">
  <input type="radio" id="html" name="fav_language" value="HTML">
  <label for="html">HTML</label><br>
  <input type="radio" id="css" name="fav_language" value="CSS">
  <label for="css">CSS</label><br>
  <input type="radio" id="javascript" name="fav_language" value="JavaScript">
  <label for="javascript">JavaScript</label><br><br>
  <input type="submit" value="Submit">
</form>

</body>
</html>

Output should be:

How to add Three radio buttons with labels

How to Perform a calculation and show the result in an <output> element

Output Example.

index.html
Example: HTML
<!DOCTYPE html>
<html>
<body>

<h1>The output element</h1>

<form oninput="x.value=parseInt(a.value)+parseInt(b.value)">
<input type="range" id="a" value="50">
+<input type="number" id="b" value="25">
=<output name="x" for="a b"></output>
</form>

<p><strong>Note:</strong> The output element is not supported in Edge 12 (or earlier).</p>

</body>
</html>

Output should be:

How to Perform a calculation and show the result in an <output> element




html for attribute

Related Articles
How to add HTML accept Attribute HTML Input HTML Attribute
How to add HTML accept-charset Attribute HTML Attribute
What is HTML accesskey Attribute HTML Attribute
What is HTML action Attribute HTML Attribute
What is HTML alt Attribute HTML Attribute
What is HTML async Attribute HTML Attribute
What is HTML autocomplete Attribute in HTML HTML Attribute
What is HTML autofocus Attribute HTML Attribute
What is HTML autoplay Attribute HTML Attribute
What is HTML charset Attribute HTML Attribute
What is HTML checked Attribute HTML Attribute
What is HTML cite Attribute HTML Attribute
What is HTML class Attribute HTML Attribute
What is HTML cols Attribute HTML Attribute
What is HTML colspan Attribute HTML Attribute
What is HTML content Attribute HTML Attribute
What is HTML contenteditable Attribute HTML Attribute
What is HTML controls Attribute HTML Attribute
What is HTML coords Attribute HTML Attribute
What is HTML data Attribute HTML Attribute
What is HTML data-* Attribute HTML Attribute
What is HTML datetime Attribute HTML Attribute
What is HTML controls Attribute HTML Attribute
What is HTML default Attribute HTML Attribute
What is HTML defer Attribute HTML Attribute
What is HTML dir Attribute HTML Attribute
What is HTML dirname Attribute HTML Attribute
What is HTML disabled Attribute HTML Attribute
What is HTML download Attribute HTML Attribute
What is HTML draggable Attribute HTML Attribute
What is HTML enctype Attribute HTML Attribute
What is HTML enterkeyhint Attribute HTML Attribute
What is HTML for Attribute HTML Attribute
What is HTML form Attribute HTML Attribute
What is HTML formaction Attribute HTML Attribute
What is HTML headers Attribute HTML Attribute
What is HTML height Attribute HTML Attribute
What is HTML hidden Attribute HTML Attribute
What is HTML high Attribute HTML Attribute
What is HTML href Attribute HTML Attribute
What is HTML hreflang Attribute HTML Attribute
What is HTML http-equiv Attribute HTML Attribute
What is HTML id Attribute HTML Attribute
What is HTML inert Attribute HTML Attribute
What is HTML inputmode Attribute HTML Attribute
What is HTML ismap Attribute HTML Attribute
What is HTML kind Attribute HTML Attribute
What is HTML label Attribute HTML Attribute
What is HTML lang Attribute HTML Attribute
What is HTML list Attribute HTML Attribute
What is HTML loop Attribute HTML Attribute
What is HTML low Attribute HTML Attribute
What is HTML max Attribute HTML Attribute
What is HTML maxlength Attribute HTML Attribute
What is HTML media Attribute HTML Attribute
What is HTML method Attribute HTML Attribute
What is HTML min Attribute HTML Attribute
What is HTML multiple Attribute HTML Attribute
What is HTML muted Attribute HTML Attribute
What is HTML name Attribute HTML Attribute
What is HTML novalidate Attribute HTML Attribute
What is HTML onabort Attribute HTML Attribute
What is HTML onafterprint Attribute HTML Attribute
What is HTML onbeforeprint Attribute HTML Attribute
What is HTML onbeforeunload Attribute HTML Attribute
What is HTML onblur Attribute HTML Attribute
What is HTML oncanplay Attribute HTML Attribute
What is HTML oncanplaythrough Attribute HTML Attribute
What is HTML onchange Attribute HTML Attribute
What is HTML onclick Attribute HTML Attribute

Single Articles
How to add Three radio buttons with labelsHTML Attribute
How to Perform a calculation and show the result in an <output> elementHTML Attribute

Read Full:
HTML Attribute
Type:
Develop
Category:
Web Tutorial
Sub Category:
HTML Attribute
Uploaded:
1 week ago
Uploaded by:
Admin
Views:
31


Reffered: https://www.w3schools.com/tags/att_for.asp

Share on: