admin 管理员组文章数量: 1086019
I'm having an issue with the following checkbox in IE 8 and below not being checked:
<input type="checkbox" data-bind="event: { change: $parent.addOtherAddresses }, attr: { value: $index() + 1 }" />
I'm trying to pass an entire object to 'addOtherAddresses', which it actually does and works fine, however the browser does not show the checkbox as actually being checked.
I've tried other solutions that display the check in the checkbox but only return the id or value of the checkbox, I need the entire parent data object returned so I can do other logic based on whats been checked.
Thanks for the help.
I'm having an issue with the following checkbox in IE 8 and below not being checked:
<input type="checkbox" data-bind="event: { change: $parent.addOtherAddresses }, attr: { value: $index() + 1 }" />
I'm trying to pass an entire object to 'addOtherAddresses', which it actually does and works fine, however the browser does not show the checkbox as actually being checked.
I've tried other solutions that display the check in the checkbox but only return the id or value of the checkbox, I need the entire parent data object returned so I can do other logic based on whats been checked.
Thanks for the help.
Share Improve this question asked Feb 21, 2013 at 0:50 GPBGPB 931 silver badge14 bronze badges 2-
Does it have anything to do with the fact that you're not closing your
data-bind
attribute? Or is that a typo in this post and not copied from your code? - Edit: apparently a typo since it's fixed now. – Robin van Baalen Commented Feb 21, 2013 at 0:53 - It was just a typo from this post – GPB Commented Feb 21, 2013 at 0:55
1 Answer
Reset to default 12The problem is that the change
event handler prevents the default action by the browser because that's what Knockout does by default. If you want to allow the browser's default action, you must return true
from your handler:
event: { change: function() { $parent.addOtherAddress($data); return true; } }
本文标签: javascriptCheckbox not checked when clicked in IE 8 and below using knockout bindingStack Overflow
版权声明:本文标题:javascript - Checkbox not checked when clicked in IE 8 and below using knockout binding - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.roclinux.cn/p/1744063836a2527216.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论