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

Which html elements have the for attribute

青灯夜游
Release: 2023-01-06 11:12:17
Original
2895 people have browsed it

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

#When for is used with the When used with the element, the for attribute specifies the relationship between the calculation result and the elements used in the calculation.
Element name Description

##

Syntax

<label for="element_id">
Copy after login
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>
Copy after login

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

Grammar

<output for="element_id">
Copy after login

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>
Copy after login
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!

Related labels:
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template