Using keypress event in knockout JS
Using keypress event in knockout JS
- Check that the query is an observable
- Use valueUpdate = ‘afterkeydown’
- Use event: { ‘keyup’: check }:
Use the console.log if possible as opposed to alert, and log the query to check the value is updating.. For log the event ,See this
function check(data, event) { console.log(event); }
The KO docs, at least as of now, specifically addresses this issue:
Note 1: textInput vs value binding
Eventhough the value binding do two-way binding between text boxes and viewmodel properties, Then prefer the textInput whenever sudden live updates is needed.
See http://knockoutjs.com/documentation/textinput-binding.html