Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. ToggleEvent
  4. newState

ToggleEvent: newState property

Baseline 2023
Newly available

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

ThenewState read-only property of theToggleEvent interface is a string representing the state the element is transitioning to.

Value

A string. Possible values are"open" (the popover is being shown) or"closed" (the popover is being hidden).

Examples

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");  }});

Specifications

Specification
HTML
# dom-toggleevent-newstate

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp