-2

我在我的项目中使用 jsViews 并遇到了问题:当我使用 JQuery 更改输入值时,DOM 没有改变。

我使用自定义标签:{^{edit NOTE holderWidth='90'/}}pm.mACQUAINTANCE.Items[2].row.NOTE在 DOM 中是“1111”,在 aspx 页面上{^{edit}}是标签 <input id="472_ACQUAINTANCE_NOTE" class="valid" name="NOTE472">

$("#472_ACQUAINTANCE_NOTE").val("2222"); $("#472_ACQUAINTANCE_NOTE").val()将“2222”之后,pm.mACQUAINTANCE.Items[2].row.NOTE在 DOM 中仍然是“1111”

:( 请帮忙

4

1 回答 1

0

If you want to change the value in the input using jQuery, and you want that value to trigger an update to the model, you will need to write

$("#472_ACQUAINTANCE_NOTE").val("2222").change();

or

$("#472_ACQUAINTANCE_NOTE").val("2222");
$("#472_ACQUAINTANCE_NOTE").change();

to trigger a DOM element change event - which will then trigger the data binding.

(You can also use either change() or blur())

于 2014-09-01T15:50:26.217 回答