HTMLButtonElement: Command Property(developer.mozilla.org)
developer.mozilla.org
HTMLButtonElement: Command Property
https://developer.mozilla.org/en-US/docs/Web/API/HTMLButtonElement/command
2 comments
Instead of attaching click event listeners to each button you can just have one event listener. Makes sense when there is a single target. Nice to have in the tool belt.
I think I understand how this command attribute API works, but it strikes me as superfluous. Why not just use onclick with maybe currentTarget and/or data attributes?