The click event

We have been using the click binding in the last three chapters. In this one, you are going to learn more about this event. The click event is the basic event that users use to interact with an application since the mouse has been the peripheral par excellence (also the keyboard).

You must have learned that if you attach a function to the click binding, this function is fired with the click event. The problem is that in Knockout the click event doesn't accept parameters. The arguments of our click function are predefined, as far as we know.

Passing more parameters

As we have mentioned, the function we bind to the click event has a predefined signature: function functionName(data, event){...}, and both the parameters are already assigned: ...

Get KnockoutJS Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.