Reputation: 3996
We have an input of type number with a knockout binding like this:
<inputtype="number" data-bind="value: quantity" />
This works perfectly on Chrome and EDGE but not on Firefox. Whenever we change the value and press save, the value gets reset to the previous value.
Any idea why this is not working?
Upvotes: 1
Views: 224
Reputation: 531
Please use 'textInput' binding instead of 'value' for 2-way bindings. From the documentation:
Browsers are highly inconsistent in the events that fire in response to unusual text entry mechanisms such as cutting, dragging, or accepting autocomplete suggestions. The value binding, even with extra options such as valueUpdate: afterkeydown to get updates on particular events, does not cover all text entry scenarios on all browsers.
The textInput binding is specifically designed to handle a wide range of browser quirks, to provide consistent and immediate model updates even in response to unusual text entry methods.
http://knockoutjs.com/documentation/textinput-binding.html
In case it doesn't help, please post your view model and recheck that there are no other event handlers bound to the same DOM element.
Upvotes: 1