Reputation: 302
I have something like this:
<div class="dialog" data-bind="event: {click: clickEvent}">
...
<div class="myClass">
<label><input type="checkbox" name="cbname" class="checkbox" data-bind="checked: checkedFunction" /></label>
</div>
...
</div>
Because of the event click, my checkbox is always checked and there is no way to uncheck it. If I remove the event click on the parent div, everything works good.
Do you have any idea why it's not working?
Thanks
Upvotes: 0
Views: 174
Reputation: 17564
Your click handler must return true, otherwise it will cancel bubble of click event
foo: function() {
this.fooCount(this.fooCount() + 1);
return true;
}
edit: As a side note I think its very wrong that the viewmodel needs to be wary of this. Bubbling of click events is a View only notion, and because of that it should not need to be handled by the VM
Upvotes: 2