HTML DOM
The alpha property of the HTMLInputElement interface reflects the input element's alpha attribute, which indicates whether the CSS color's alpha component can be manipulated by the end user and does not have to be fully opaque. It is only relevant to color controls.
Value
A boolean value.
Examples
<input id="color-picker" type="color" alpha />
const colorInput = document.getElementById("color-picker");
if (colorInput.alpha) {
// Color values contain an alpha component
} else {
// We have fully opaque color values
}
Specifications
Browser compatibility
See also
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
