According to knockoutjs documentation, the value of an observable will update when the change event will occur.
Whenever the user edits the value in the associated form control, KO
will update the property on your view model. KO will always attempt to
update your view model when the value has been modified and a user
transfers focus to another DOM node (i.e., on the change event), but
you can also trigger updates based on other events by using the
valueUpdate parameter
There is only one valueUpdate
parameter exists that matches the criteria of your problem. The input
parameter but it has some limitations according to documentation...
"input" - updates your view model when the value of an or
element changes. Note that this event is only raised by
reasonably modern browsers (e.g., IE 9+).
So, I think the best choice for you is to take the solution provided by Michael Best, trigger the change()
event manually as following...
$("#test").val("test2").change();