Knockout value binding doesn't work with jquery autocomplte. How to get it working?
I have a template:
<input
type="text"
class="autocomplete"
data-bind="value: viewModelObservableValue"
name="MyValue" />
After template rendering I am applying jQuery autocomplete on an input. Binding doesn't work. See my jsfiddle.
It works only if ko.applyBindings(viewModel)
goes after $(..).autocomplete(..);
It looks like jQuery autocomplete hijacked the
change
event. Thats why it doesn't work.To fix this, you'll have to set the
valueUpdate
property toblur
. Of course, this won't trigger after selecting the item, you'll have to blur first.