Element: ariaPlaceholder プロパティ

Baseline 2023
Newly available

Since October 2023, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.

ariaPlaceholderElement インターフェイスのプロパティで、aria-placeholder 属性の値を反映します。この属性は、コントロールに値がない場合表示する、ユーザーのデータ入力を助けることを意図した短いヒントを定義します。

メモ: 可能であれば、HTML の <input> 要素の type="text"<textarea> を使用してください。これらは意味づけがあり、ARIA 属性を必要としません。

文字列です。

この例では、IDが txtBoxInput の要素の aria-placeholder 属性には文字列が設定されています。ariaPlaceholderを使用して、文字列を別の値に更新します。

html
<div id="txtboxLabel">Enter your five-digit zipcode</div>
<div
  role="textbox"
  id="txtBoxInput"
  contenteditable="true"
  aria-placeholder="5-digit zipcode"
  aria-labelledby="txtboxLabel"></div>
js
let el = document.getElementById("txtBoxInput");
console.log(el.ariaPlaceholder); // "5-digit zipcode"
el.ariaPlaceholder = "12345";
console.log(el.ariaPlaceholder); // "12345"

仕様書

Specification
Accessible Rich Internet Applications (WAI-ARIA)
# dom-ariamixin-ariaplaceholder

ブラウザーの互換性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
ariaPlaceholder

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

関連情報