Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to Uncheck other check boxes programatically #1

Open
mariorancic opened this issue Nov 30, 2015 · 3 comments
Open

How to Uncheck other check boxes programatically #1

mariorancic opened this issue Nov 30, 2015 · 3 comments

Comments

@mariorancic
Copy link

This plugin works great but how to uncheck other check box when his pair check box is checked. I tried this:

function InitilizeCheckBoxes01(chId01, chId02)
{

    jQuery(chId01).flatcheckbox({
        onChecked: function (el) {
            jQuery(chId02).prop('checked', 'false');
            jQuery(jQuery(chId02).next()).removeClass('flchecked');

        },
        onUnChecked: function (el) {

        },
    });

    jQuery(chId02).flatcheckbox({
        onChecked: function (el) {
            jQuery(chId01).prop('checked', 'false');
            jQuery(jQuery(chId01).next()).removeClass('flchecked');

        },
        onUnChecked: function (el) {
        },
    });
}

This uchecks other check box but with 2 clicks.

Thx.

@JosHuybrighs
Copy link
Owner

Thanks for the request.
I got similar questions in the past and so I decided to add an 'uncheck' method to the plugin. You can invoke that method in an 'onChecked' handler to uncheck any other checkbox. Hope it makes life easier now.
See the tutorial and demo for more information. GitHub is also updated with the new version.

@mariorancic
Copy link
Author

I tested it. It works great. This makes life easier. Thank you.

@mariorancic
Copy link
Author

It seems that min version of the script does not work properly for unchecking other checkboxes programmatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants