Reputation: 124
I noticed a difference between how the Knockout.js observable binding works in Chrome/Firefox/Safari vs Internet Explorer 9.
I have tried this both in jsfiddle http://jsfiddle.net/rniemeyer/LkqTU/ and from the Knockout.js web at http://knockoutjs.com/examples/helloWorld.html.
In Internet Explorer 9 I have to leave the fields to see the change, but in Chrome/Firefox/Safari I can just press enter to see the change.
Is this how it suppose to be or is there a bug somewhere? I would like it to be like in Chrome/Firefox/Safari.
Upvotes: 1
Views: 2031
Reputation: 3634
For the computed value to be shown as you type in IE, as it does in Chrome / Safari / FF, you need to bind the valueUpdate property of the data-bind to afterkeydown, like so:
<div class='liveExample'>
<p>First name: <input data-bind="value: firstName, valueUpdate: 'afterkeydown'" /></p>
<p>Last name: <input data-bind="value: lastName, valueUpdate: 'afterkeydown'" /></p>
<h2>Hello, <span data-bind='text: fullName'> </span>!</h2>
</div>
Upvotes: 5