【发布时间】:2014-01-17 12:36:21
【问题描述】:
我正在使用 jsviews 进行数据绑定:
我的模板
<script id = "ProfileTemplate" type="text/x-jsrender">
<input data-link="userVO.first_name" type="text">
<input type="reset" value="Reset" onclick="this.form.reset();">
</script>
我的表格
<form name="profile-form" id="profile-form" action="profile.html">
<div id="flightEditDetail"></div>`enter code here`
</form>
<script>
var template = $.templates("#ProfileTemplate");
template.link("#flightEditDetail", profileJSON);
</script>
模板正确绑定了值。我更改了文本字段中的值并单击了重置按钮。文本字段变为空,但我想要在页面加载时呈现的值。
为什么 reset() 函数不能与 jsviews data-link 一起正常工作
【问题讨论】:
-
欢迎来到 StackOverflow。我已经稍微重新格式化了您的问题,以使模板和表单格式正确。请查看stackoverflow.com/editing-help,了解如何格式化您的问题的详细信息。