Consider the following code:
HTML:
Click here
JS:
$(function() {
$('input').click(function() {
document.write($(this).is(':checked') ? "checked" : "unckecked");
});
$('div').click(function() {
$('input').click();
});
});
When the checkbox is clicked, the output is checked
, but if "Click here" is clicked the output is unckecked
. Why is that?