Knockout.js bound input value not updated when I use jquery .val('xyz')

后端 未结 1 1680
花落未央
花落未央 2020-12-07 19:34

I have an input that has a knockout binding to the value.

When I update the value using jquery\'s .val() method, the changed value is not reflected in the viewModel.

相关标签:
1条回答
  • 2020-12-07 20:29

    .val() does not trigger the change event. So, you can just do .val("blah").change() for KO to pick up the changes.

    0 讨论(0)
提交回复
热议问题