I've got the following code:
<div style="cursor:pointer" onclick="alert('div clicked');">
<input
type="checkbox"
onclick="alert('checkbox clicked');"
style="pointer-events:none">
Show Retired Products
</div>
When I click the div (such as by clicking on the "Show Retired Products" text), it correctly fires the onclick event for the div in both browsers. However, if I click the actual checkbox, the behavior between Chrome and IE differs.
In Chrome, when I click the actual checkbox, the input's onclick never fires, nor does the state of the checkbox change. The div's onclick event does fire, though.
In IE, when I click the actual checkbox, first the checkbox's onclick event fires, and then the div's onclick event fires (which can be prevent with event.stopPropagation if I want).
Why isn't the input getting toggled in Chrome? How can I make these behave identically? Which browser is actually working "correctly"?
In case it matters, Chrome is version 40.0.2214.93 and IE is 11.0.9600.17498.
Just tested in Firefox 32.0 and it functions identical to Chrome.