HTMLInputElement: alpha property
HTML DOM
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
}