HTMLInputElement: alpha property

فهرست فصل‌ها دانلود آرشیوناشر

MDN Web Docs · نسخهٔ df622a2a1c1e · CC BY-SA 2.5 و مجوز جداگانهٔ ناشر برای نمونه‌کد

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

The **alpha** property of the {{domxref("HTMLInputElement")}} interface reflects the {{htmlelement("input")}} element's [alpha](/en-US/docs/Web/HTML/Reference/Elements/input/color#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

{{Specifications}}

Browser compatibility

{{Compat}}

See also

  • [<input type="color">](/en-US/docs/Web/HTML/Reference/Elements/input/color)