🏠 New in Low Baseline Support: Invoker commands
December 12, 2025
The command and commandfor attributes for the <button> HTML element dispatch an action to an element when the button is invoked (by click or keystroke), as a declarative alternative to addEventListener() calls or onclick attribute handlers.
Source features
api.CommandEvent[mdn]api.CommandEvent.CommandEvent[mdn]api.CommandEvent.command[mdn]api.CommandEvent.source[mdn]api.HTMLButtonElement.command[mdn]api.HTMLButtonElement.commandForElement[mdn]api.HTMLElement.command_event[mdn]html.elements.button.command[mdn]html.elements.button.commandfor[mdn]