HTMLButtonElement: commandForElement-Eigenschaft
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Experimentell: Dies ist eine experimentelle Technologie
Überprüfen Sie die Browser-Kompatibilitätstabelle sorgfältig vor der Verwendung auf produktiven Webseiten.
Die commandForElement
-Eigenschaft der HTMLButtonElement
-Schnittstelle ruft das Element ab und setzt es, das über einen Button gesteuert wird.
Es ist das JavaScript-Äquivalent des commandfor
-HTML-Attributs.
Wert
Ein Verweis auf ein vorhandenes Element
, das der Button steuert.
Beispiele
js
const popover = document.getElementById("mypopover");
const toggleBtn = document.getElementById("toggleBtn");
toggleBtn.commandForElement = popover;
Spezifikationen
Specification |
---|
HTML # dom-button-commandforelement |
Browser-Kompatibilität
BCD tables only load in the browser