Please see my other JavaScript articles.
Using Knockout.js to dynamically bind events to fields.
In most web applications, the user drives the business process being invoked.
Therefore, it’s necessary to allow them to “fire” events in order to provide the desired functionality.
To illustrate how to integrate an event, I will begin where my last Knockout.js: Computed fields article left off.
As you can see, I’m beginning with enough code to grab the first three values and assign it to “Sales Associate Overview.”
The change I want to happen will double the sales revenue entered so I’ll add a function to achieve that requirement within the ViewModel.
Next, I’ll a button that is bound to the “click” event and executes my doubleRevenue() function.
Now my page contains a button which lets me double the revenue entered when I click it.