Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
13 lines (12 sloc) 1.11 KB
layout title date tags
post
Spending hours on trying to figure out why it does not check
2012-07-31 09:36:00 +0200
javascript knockout

Yesterday I spent hours trying to figure out why a checkbox did not get checked (visually). When debugging the knockout code, it was clear that the DOM elements got checked. They did not update visually until another checkbox got checked. I tried other methods of checking the checkbox (both setAttribute and jquery) to no affect. What was even weirder is that it works the same in both chrome and IE.

To reproduce, click on the first checkbox and then the second in this fiddle.

I got the question if I had a click event handler from steal my code.

Turns out that the reason for this behavior is that I had a click event handler on a parent DOM element. By having the click handler return true the problem was resolved.

I still don't understand why it works like this.