Home >Web Front-end >Front-end Q&A >Which html elements have the for attribute

Which html elements have the for attribute

青灯夜游
青灯夜游Original
2021-05-11 16:17:052846browse

HTML elements with for attributes: 1. label element; when for is used with the label element, the for attribute specifies which form element the label is bound to. 2. Output element; when for is used with the output element, the for attribute specifies the relationship between the calculation result and the elements used in the calculation.

Which html elements have the for attribute

The operating environment of this tutorial: Windows 7 system, HTML5 version, Dell G3 computer.

HTML elements to which the for attribute applies

#2e1cf0710519d5598b1f0f14c36ba674When for is used with the 2e1cf0710519d5598b1f0f14c36ba674 element, for Property specifies which form element the label is bound to. be6d67dae90cc1ad6469079e163d0939When used with the be6d67dae90cc1ad6469079e163d0939 element, the for attribute specifies the relationship between the calculation result and the elements used in the calculation.
Element name Description

##2e1cf0710519d5598b1f0f14c36ba674label for attributeThe for attribute specifies which form element the label is bound to .

Syntax

<label for="element_id">
element_id: label The id of the element to be bound.

Example

<form action="/jc_script/action.php">
  <label for="php">PHP</label>
  <input type="radio" name="lang" id="php" value="php"><br>
  <label for="java">Java</label>
  <input type="radio" name="lang" id="java" value="java"><br>
  <label for="python">Python</label>
  <input type="radio" name="lang" id="python" value="python"><br><br>
  <input type="submit" value="提交">
</form>

be6d67dae90cc1ad6469079e163d0939Tag for attributefor attribute specifies the calculation result Relationship to elements used in calculations.

Grammar

<output for="element_id">

Example

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

html video tutorial

"

The above is the detailed content of Which html elements have the for attribute. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn