Table of Contents

Class HTMLLabelElement

Namespace
CSharpToJavaScript.APIs.JS
Assembly
CSharpToJavaScript.dll

The HTMLLabelElement interface gives access to properties specific to {{HTMLElement("label")}} elements. It inherits methods and properties from the base HTMLElement interface.

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

Remarks

-The HTML element implementing this interface: label
-form
-HTMLFormElement

See also on MDN

Constructors

HTMLLabelElement()

public HTMLLabelElement()

Properties

Control

The read-only HTMLLabelElement.control property returns a
reference to the control (in the form of an object of type HTMLElement or
one of its derivatives) with which the label element is associated,
or null if the label isn't associated with a control.

[Value("control")]
public HTMLElement? Control { get; }

Property Value

HTMLElement

An HTMLElement derived object representing the control with which the
label is associated, or null if the label stands alone.

NOTE
If this property has a value and HtmlFor has a value,
the HtmlFor property must refer to the same control.

Remarks

Form

The form read-only property of the HTMLLabelElement interface returns an HTMLFormElement object that owns the Control associated with this {{HTMLElement("label")}}, or null if this label is not associated with a control owned by a form.

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

Property Value

HTMLFormElement

An HTMLFormElement or null.

Remarks

This property is just a shortcut for label.control.form.

-HTMLLabelElement
-Form
-HTMLFormElement
-label
-HTML forms guide

See also on MDN

HtmlFor

The HTMLLabelElement.htmlFor property reflects the value
of the for content property. That means that this
script-accessible property is used to set and read the value of the content property
for, which is the ID of the label's associated control element.

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

Property Value

string

A string which contains the ID string of the element which is
associated with the control.

NOTE
If this property has a value, the Control property
must refer to the same control.

Remarks