Reputation: 4484
I have an input field that is bound to an observable object. I'm subscribing to the change so I can do some ui changes as they're entering data. Currently the subscribe event gets called after the user clicks outside of the input. Is there any way to change the subscribe so it updates as the user enters characters in the input field?
Upvotes: 0
Views: 216
Reputation: 2354
Here's how I do it.
HTML:
<input type="text" data-bind="value: filter, valueUpdate: 'afterkeydown'" />
JS:
filter = ko.observable("");
Upvotes: 1
Reputation: 26730
There is the "valueUpdate" parameter / "binding" for this:
<input data-bind="value: someObservable, valueUpdate: 'afterkeydown'">
Upvotes: 1