HTMLElement
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.
HTMLElement 接口表示所有的 HTML 元素。一些 HTML 元素直接实现了 HTMLElement 接口,其他的间接实现 HTMLElement 接口。
属性
继承自父接口 Element
和 GlobalEventHandlers
的属性。
事件
Listen to these events using addEventListener()
or by assigning an event listener to the oneventname
property of this interface.
copy
-
Fired when the user initiates a copy action through the browser's user interface.
cut
-
Fired when the user initiates a cut action through the browser's user interface.
paste
-
Fired when the user initiates a paste action through the browser's user interface.
invalid
-
Fired when an element does not satisfy its constraints during constraint validation.
方法
从父元素继承的方法,Element
.
Name & Arguments | Return | Description |
---|---|---|
HTMLElement.blur() |
void |
元素失去焦点 |
HTMLElement.click() |
void |
触发元素的点击事件 |
HTMLElement.focus() |
void |
元素获得焦点 |
HTMLElement.forceSpellCheck()
实验性
|
void |
规范
Specification |
---|
HTML Standard # htmlelement |
浏览器兼容性
BCD tables only load in the browser