我遇到了将我的JQuery Mobile Checkbox与我的Knockout绑定绑定的问题。表单其他部分的所有文本框都正常工作,您可以通过此图像看到布尔值设置为true(加入奖励和输入比赛的值)。
<div data-role="fieldcontain">
<fieldset data-role="controlgroup">
<legend>Sign up for extras</legend>
<label for="IsInRewards">Join Rewards</label>
<input type="checkbox" data-bind="checked: IsInRewards" id="IsInRewards" class="custom" />
<label for="IsEnterContest">Enter Contest</label>
<input type="checkbox" data-bind="checked: IsEnterContest" id="IsEnterContest" class="custom" />
<br />
Value of Join Rewards (IsInRewards) : <span data-bind="text: IsInRewards"></span>
<br />
Value of Enter Contest (IsEnterContest) : <span data-bind="text: IsEnterContest"></span>
</fieldset>
</div>
我已经读过Knockout和JQuery处理事件的方式之间存在一些问题,所以我怀疑我的问题与此有关,但我无法弄明白。如果让两个JQuery复选框字段显示数据绑定中的值,我需要做什么?
答案 0 :(得分:0)
不难做..您可以为jquery ui复选框创建自定义绑定处理程序http://knockoutjs.com/documentation/custom-bindings.html