| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/ja/docs/Web/API/HTMLButtonElement/command | [Back] [Original] |
Get to know MDN better
<button id="toggleBtn" commandfor="mypopover" command="toggle-popover">
</button>
<div popover id="mypopover">
<button commandfor="mypopover" command="hide-popover">
</button>
</div>
const popover = document.getElementById("mypopover");
const toggleBtn = document.getElementById("toggleBtn");
toggleBtn.command = "show-popover";
<button commandfor="the-image" command="--rotate-left"></button>
<button commandfor="the-image" command="--rotate-right"></button>
<img id="the-image" src="photo.jpg" alt="[]" />
const image = document.getElementById("the-image");
image.addEventListener("command", (event) => {
if (event.command == "--rotate-left") {
event.target.style.rotate = "-90deg";
} else if (event.command == "--rotate-right") {
event.target.style.rotate = "90deg";
}
});
| HTML # dom-button-command |
HTMLButtonElement| Web Proxy Viewer | New URL | Original Page |