KnockoutJs cannot update the control value on mobile devices.
Recently, I used cordova (phonegap) to write a mobile app. The form is complicated and knockoutJs is used as the front-end MVVM framework for data binding.
However, sometimes (in fact, every time) if you finally edit a value in the input, and then click the Save button directly (using the JQM tap event, the same is true for touchend ), the value of the control with the last focus is not updated.
It is estimated that KO's value binding is by default to update the value in view model when the control triggers the change event, but it does not know why clicking the Save button does not trigger the last change event in the input.
The solution is also very simple. in the response event of the Save button, manually trigger the change of the current control:
1: if (document. activeElement ){
2: $ (document. activeElement). trigger ("change ");
3 :}
This problem does not exist in PC browsers, so it was not found when using the Ripple simulator, but this problem exists on iOS and android. I don't know why ......