TL;DR: expected <button onclick="submit">...</button> to work with an event handler function submit(e) { ... }, but found out that it had to be <button onclick="submit(event)">...</button> (specifically, the magic word event, which is treated specially inside an onXXX attribute).
:) Well the tldr would be something along the lines of event in <button onclick="submit(event)> isn’t magic, it’s a parameter in a dynamically created function, built from string concatenation, defined for event handler functions in page X of the spec.
TL;DR: expected
<button onclick="submit">...</button>
to work with an event handlerfunction submit(e) { ... }
, but found out that it had to be<button onclick="submit(event)">...</button>
(specifically, the magic wordevent
, which is treated specially inside anonXXX
attribute).:) Well the tldr would be something along the lines of
event
in<button onclick="submit(event)>
isn’t magic, it’s a parameter in a dynamically created function, built from string concatenation, defined for event handler functions in page X of the spec.