I am working with a HTML form with input binding to a Knockout viewmodel. Two of the form inputs are double types for latitude/longitude co-ordinates:
<div class="form-group">
<input class="form-control" name="Observation.LocationLatitude" data-bind="value: Observation.LocationLatitude" id="latitude" />
<input class="form-control" name="Observation.LocationLongitude" data-bind="value: Observation.LocationLongitude" id="longitude" />
</div>
I update these from my Google Maps javascript function like this:
document.getElementById('latitude').value = markers[0].position.lat();
document.getElementById('longitude').value = markers[0].position.lng();
The code updates the input fields, but does not update the binding to the viewmodel.
The only way the viewmodel is updated is if I type directly to the input field. Following the documentation, I have tried the "textInput" binding, as well as the value input binding without success. I have also tried to set/update the focus of the input field in the Javascript. That also did not work.
Does anyone know if it is possible to update the binding from Javascript?