Table of Contents

Class HTMLOutputElement

Namespace
CSharpToJavaScript.APIs.JS
Assembly
CSharpToJavaScript.dll

The HTMLOutputElement interface provides properties and methods (beyond those inherited from HTMLElement) for manipulating the layout and presentation of {{HTMLElement("output")}} elements.

[Value("HTMLOutputElement")]
public class HTMLOutputElement : HTMLElement
Inheritance
HTMLOutputElement
Inherited Members

Remarks

-The HTML element implementing this interface: output.

See also on MDN

Constructors

HTMLOutputElement()

public HTMLOutputElement()

Properties

DefaultValue

The defaultValue property of the HTMLOutputElement interface represents the default text content of this {{htmlelement("output")}} element. Getting and setting this value is equivalent to getting and setting TextContent on the {{htmlelement("output")}}.

[Value("defaultValue")]
public string DefaultValue { get; set; }

Property Value

string

A string.

Remarks

Form

The form read-only property of the HTMLOutputElement interface returns an HTMLFormElement object that owns this {{htmlelement("output")}}, or null if this output is not owned by any form.

[Value("form")]
public HTMLFormElement? Form { get; }

Property Value

HTMLFormElement

An HTMLFormElement or null.

Remarks

HtmlFor

The htmlFor property of the HTMLOutputElement interface is a string containing a space-separated list of other elements' ids, indicating that those elements contributed input values to (or otherwise affected) the calculation. It reflects the for attribute of the output element.

[Value("htmlFor")]
public DOMTokenList HtmlFor { get; }

Property Value

DOMTokenList

A string.

Remarks

Labels

The HTMLOutputElement.labels read-only property returns a
NodeList of the {{HTMLElement("label")}} elements associated with the
output element.

[Value("labels")]
public NodeList Labels { get; }

Property Value

NodeList

A NodeList containing the <label> elements associated
with the <output> element.

Remarks

Name

The name property of the HTMLOutputElement interface indicates the name of the {{HTMLElement("output")}} element. It reflects the element's name attribute.

[Value("name")]
public string Name { get; set; }

Property Value

string

A string representing the element's name.

Remarks

Type

The type read-only property of the HTMLOutputElement interface returns the string "output".

[Value("type")]
public string Type { get; }

Property Value

string

The string "output".

Remarks

ValidationMessage

The validationMessage read-only property of the HTMLOutputElement interface returns a string representing a localized message that describes the validation constraints that the {{htmlelement("output")}} control does not satisfy (if any). This is the empty string as <output> elements are not candidates for constraint validation (WillValidate is false).

[Value("validationMessage")]
public string ValidationMessage { get; }

Property Value

string

The empty string, "";

Remarks

Validity

The validity read-only property of the HTMLOutputElement interface returns a ValidityState object that represents the validity states this element is in. Although {{HTMLElement("output")}} elements are never candidates for constraint validation, the validity state may still be invalid if a custom validity message has been set.

[Value("validity")]
public ValidityState Validity { get; }

Property Value

ValidityState

A ValidityState object.

Remarks

Value

The value property of the HTMLOutputElement interface represents the value of the {{htmlelement("output")}} element as a string, or the empty string if no value is set. It returns or sets the contents of the element, similar to the TextContent property.

[Value("value")]
public string Value { get; set; }

Property Value

string

A string containing the contents of the output element.

Remarks

NOTE

When the value property of an <output> element is set, the element goes into value mode and the default value is accessible only through the DefaultValue property.

-output
-DefaultValue
-Labels
-HtmlFor

See also on MDN

WillValidate

The willValidate read-only property of the HTMLOutputElement interface returns false, because output elements are not candidates for constraint validation.

[Value("willValidate")]
public bool WillValidate { get; }

Property Value

bool

The boolean value false.

Remarks

Methods

CheckValidity()

The checkValidity() method of the HTMLOutputElement interface checks if the element is valid, but always returns true because {{HTMLElement("output")}} elements are never candidates for constraint validation.

[Value("checkValidity")]
public bool CheckValidity()

Returns

bool

A boolean value, true.

Remarks

ReportValidity()

The reportValidity() method of the HTMLOutputElement interface performs the same validity checking steps as the CheckValidity() method. It always returns true because {{HTMLElement("output")}} elements are never candidates for constraint validation.

[Value("reportValidity")]
public bool ReportValidity()

Returns

bool

A boolean value, true.

Remarks

SetCustomValidity(string)

The setCustomValidity() method of the HTMLOutputElement interface sets the custom validity message for the {{htmlelement("output")}} element. Use the empty string to indicate that the element does not have a custom validity error.

[Value("setCustomValidity")]
public GlobalObject.Undefined SetCustomValidity(string error)

Parameters

error string

Returns

GlobalObject.Undefined

None (GlobalObject.Undefined).

Remarks

The <output> element is not a candidate for constraint validation. The ReportValidity() method will not cause the custom error message to be displayed to the user, but does set the CustomError property of the element's ValidityState object to true and the Valid property to false.

-output
-HTMLOutputElement
-Validity
-CheckValidity()
-ReportValidity()
-Form validation.
-Learn: Client-side form validation
-Guide: Constraint validation
-CSS :valid and :invalid pseudo-classes

See also on MDN