HTMLButtonElement: commandForElement プロパティ
Baseline
2025
Newly available
Since December 2025, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.
Experimental: これは実験的な機能です。
本番で使用する前にブラウザー互換性一覧表をチェックしてください。
commandForElement は HTMLButtonElement インターフェイスのプロパティで、ボタンを通じて制御する要素を取得または設定します。
これは JavaScript における HTML の commandfor 属性の同等物です。
値
このボタンが制御する既存の要素 (Element) への参照です。
例
js
const popover = document.getElementById("mypopover");
const toggleBtn = document.getElementById("toggleBtn");
toggleBtn.commandForElement = popover;
仕様書
| Specification |
|---|
| HTML # dom-button-commandforelement |
ブラウザーの互換性
Enable JavaScript to view this browser compatibility table.