大佬教程收集整理的这篇文章主要介绍了jquery-mobile – Knockout和jQuery Mobile:Checkboxes,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
$('input[type="checkBox"]').checkBoxradio();
数据绑定属性将被删除.如果我省略上面的行,则正确设置数据绑定属性并且绑定有效.
有没有办法同时拥有jQuery Mobile样式和Knockout绑定?
我正在使用jQuery Mobile RC1和Knockout 1.2.1.
ko.bindingHandlers.jqmchecked = { init: ko.bindingHandlers.checked.init,update: function (element,valueAccessor) { //KO v3 and prevIoUs versions of KO handle this differently //KO v3 does not use 'update' for 'checked' binding if (ko.bindingHandlers.checked.updatE) ko.bindingHandlers.checked.update.apply(this,arguments); //for KO < v3,delegate the call else ko.utilS.UnwrapObservable(valueAccessor()); //for KO v3,force a subscription to get further updates if ($(element).data("mobile-checkBoxradio")) //calling 'refresh' only if already enhanced by JQM $(element).checkBoxradio('refresh'); } };
应该像这样使用:
<input type="checkBox" data-bind="jqmchecked: someValue" id="checkBox1"/>
请在此处查看完整的工作示例:
以上是大佬教程为你收集整理的jquery-mobile – Knockout和jQuery Mobile:Checkboxes全部内容,希望文章能够帮你解决jquery-mobile – Knockout和jQuery Mobile:Checkboxes所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。