ToggleEvent: newState-Eigenschaft
Baseline 2025Newly available
Since January 2025, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.
Die schreibgeschützte Eigenschaft newState
des ToggleEvent
-Interfaces ist ein String, der den Zustand darstellt, in den das Element wechselt.
Wert
Ein String. Mögliche Werte sind "open"
(das Popover wird angezeigt) oder "closed"
(das Popover wird ausgeblendet).
Beispiele
js
const popover = document.getElementById("mypopover");
// ...
popover.addEventListener("beforetoggle", (event) => {
if (event.newState === "open") {
console.log("Popover is being shown");
} else {
console.log("Popover is being hidden");
}
});
Spezifikationen
Specification |
---|
HTML # dom-toggleevent-newstate |
Browser-Kompatibilität
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
newState |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.