Example 1 — Read ariaReadOnly
Log the current read-only token from a custom textbox.
const el = document.getElementById("txtBoxInput");
console.log(el.ariaReadOnly); // "true"
// HTML: role="textbox" aria-readonly="true" … How It Works
- Find the widget.
getElementByIdreturns the custom textbox node. - Read the reflection.
ariaReadOnlyreturns thearia-readonlystring. - Interpret
"true". The user can focus/copy, but cannot change the value. - Missing attribute. If there is no
aria-readonly, many browsers returnnull.

