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:

Gravatar # re: jQuery - how to check/uncheck a checkbox
by sharepoint 2013 training at 10/27/2015 5:14 AM

Some truly superb blog posts on this web site ,thank you for contribution.
http://staygreenacademy.com/sharepoint-2013-training-online/
Post A Comment
Title:
Name:
Email:
Comment:
Verification: