HTML <output> for Attribute

The for attribute on an <output> tag associates the output to one or more input elements.

Example

#

A for attribute on an <output> element.
The output is associated with the slider input. Move the slider to see the output change.



The value is 25
<form oninput="result.value = slider.value">
  <input type="range" id="slider" value="25"> 
  <br /><br />
  The value is <output name="result" for="slider">25</output>
</form>

Using for

The for attribute on an output element associates the element with an input element.

The value of the for attribute is the id of the input element.

Multiple space-separated id values can be specified, one for each input element that contributes in the calculation.


Syntax

<output for="element-id">

Values

#

Value Description
element-id Space-separated list of element ids used in the output's calculation.

Browser support

Here is when for support started for each browser:

Chrome
10.0 Mar 2011
Firefox
4.0 Mar 2011
IE/Edge
13.0 Nov 2015
Opera
11.5 May 2011
Safari
7.0 Oct 2013

You may also like

 Back to <output>
Guides