HTMLButtonElement: commandForElement プロパティ

Experimental: これは実験的な機能です。
本番で使用する前にブラウザー互換性一覧表をチェックしてください。

commandForElementHTMLButtonElement インターフェイスのプロパティで、ボタンを通じて制御する要素を取得または設定します。

これは JavaScript における HTML の commandfor 属性の同等物です。

このボタンが制御する既存の要素 (Element) への参照です。

js
const popover = document.getElementById("mypopover");
const toggleBtn = document.getElementById("toggleBtn");

toggleBtn.commandForElement = popover;

仕様書

No specification found

No specification data found for api.HTMLButtonElement.commandForElement.
Check for problems with this page or contribute a missing spec_url to mdn/browser-compat-data. Also make sure the specification is included in w3c/browser-specs.

ブラウザーの互換性

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
commandForElement
Experimental

Legend

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

No support
No support
Experimental. Expect behavior to change in the future.
User must explicitly enable this feature.

関連情報