Firefox Tomorrow

web api instance property

HTMLInputElement: alpha property

View on MDN ↗

Limited availability

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

SpecificationsStandards references are available on the canonical MDN page.

Browser compatibility

Browser compatibilityCompatibility data is available on the canonical MDN page.

See also