jQuery - how to check/uncheck a checkbox

    $('#PrimaryContacts').unbind().change(function() {

 

        if ($('#PrimaryContacts option:selected').val() == 0) {

 

            $('#filterPrimaryContact').removeAttr('checked').trigger('click');

 

        }

 

        else {

 

            $('#filterPrimaryContact').trigger('click');

 

        }

 

    });

 

Also, in the example above, triggering the checkbox does not change the checkbox value. As depicted above, based on a dropdown box changing and no contact being selected from the drop down box, automatically uncheck the checkbox and trigger it in invoke any event handlers on the checkbox.
 

Print | posted @ Friday, April 30, 2010 12:33 PM

Comments on this entry:

No comments posted yet.

Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification:
 
 
Twitter