HTMLInputElement: alpha property

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

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

html
<input id="color-picker" type="color" alpha />
js
const colorInput = document.getElementById("color-picker");

if (colorInput.alpha) {
  // Color values contain an alpha component
} else {
  // We have fully opaque color values
}

Specifications

Specification
HTML
# dom-input-alpha

Browser compatibility

See also