9274
by rwaldron
HTML
<input type="checkbox">
<input type="button" value="Trigger">
<p>
First, try clicking on the ckeck-box. You'll notice that
the ckecked property is updated BEFORE the click handler
is executed.
</p>
<p>
Then, click on the "Trigger" button. You'll see that
the ckecked property is NOT updated before the click
handler is executed.
</p>
JavaScript
var checkbox = $('input:checkbox'),
button = $('input:button');
checkbox.bind("change", function() {
alert( this.checked );
});
button.click(function() {
checkbox.trigger("click");
});