HTMLLabelElement

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

HTMLLabelElement 接口允许访问特定于 <label> 元素的属性,它从基础接口 HTMLElement 继承方法和属性。

EventTarget Node Element HTMLElement HTMLLabelElement

实例属性

从其父接口 HTMLElement 继承属性。

HTMLLabelElement.control 只读

HTMLElement,表示与标签关联的控件。

HTMLLabelElement.form 只读

HTMLFormElement 对象,表示与标记的控件相关联的表单,如果没有关联的控件,或者该控件未与表单关联,则为 null。换句话说,这只是 HTMLLabelElement.control.form 的快捷方式。

HTMLLabelElement.htmlFor

包含标记的控件的 ID 的字符串。反映 for 属性。

备注: 要以编程方式设置 for 属性,请使用 htmlFor

实例方法

没有特定的方法,从其父接口 HTMLElement 继承方法。

规范

Specification
HTML
# htmllabelelement

浏览器兼容性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
HTMLLabelElement
control
form
htmlFor

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

参见