Html js event attributes need invocation

This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the javascript category.

Last Updated: 2024-11-21

I tried connecting a click handler as follows, but it did not work:

<input onclick="myfunction"`>

In reality I needed to invoke the function within the onclick attribute:

<input onclick="myfunction(event)"`>

(The event argument is optional, but you'd normally expect it.)