Jquery, checkboxes and isChecked
        Posted  
        
            by Ben
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Ben
        
        
        
        Published on 2010-04-17T22:33:45Z
        Indexed on 
            2010/04/17
            23:03 UTC
        
        
        Read the original article
        Hit count: 302
        
When I bind a function to a checkbox element like:
$("#myCheckbox").click( function() {
    alert($(this).is(":checked"));
});
The checkbox changes it checked attribute before the event is triggered, it's it normal behavior, thus giving and inverse result.
However, when I do:
$("#myCheckbox").click();
The checkbox changes it checked attribute after the event is triggered.
My question is, is there a way to trigger the click event from jquery like a normal click would do (first scenario)?
PS: I've already tried with trigger('click');
© Stack Overflow or respective owner