3 ms·
You might notice by just using the web, or you might notice it when testing the form on one of your first assignments, that you can submit a form by pressing en
by jmchuster 6y ago
You might notice by just using the web, or you might notice it when testing the form on one of your first assignments, that you can submit a form by pressing enter in an input box.
So then you might look up the documentation for the submit event on forms: https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#implicit-submission https://html.spec.whatwg.org/multipage/form-control-infrastr...
And then realize that adding the onclick handler on the submit button handles one use case (clicking the button), but a more general solution would be to add the onclick handlers on the form itself.
Then maybe you start thinking, huh, what happens when someone tabs to a button and presses enter, does the onclick handler work there? And so on and so on...
So the answer for where it's written down, it's in the documentation. But most people these days can't be bothered with things like reading documentation and textbooks and reference manuals, so, uh, I guess you just need to have a little bit of experience combined with an attention to detail?