docs.rodeo

MDN Web Docs mirror

HTMLInputElement: alpha property

{{APIRef("HTML DOM")}} {{SeeCompatTable}} 

The alpha property of the {{domxref("HTMLInputElement")}}  interface reflects the {{htmlelement("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

{{Specifications}} 

Browser compatibility

{{Compat}} 

See also

In this article

View on MDN