Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8138519
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T11:30:56+00:00 2026-06-06T11:30:56+00:00

I want to have a jquery function that will be activated when any checkbox

  • 0

I want to have a jquery function that will be activated when any checkbox is clicked and based on the value field of the checkbox that is clicked it will disable or enable other checkboxes.

So far I have:

$(function () {
    $('input [type="checkbox"]').click(function () {

    });
});

Okay, so I’ve made some progress.. but it’s still not working.

<script type="text/javascript">
$(function () {
    $(':checkbox').click(function () {

        $value = $(this).attr('value');

        if ($(this).is(':checked'))
        {
            switch ($value)
            {
                case "BLIPA":
                    $(':checkbox[value*="B"]').attr('disabled', true);
            }
        }
        else
        {
            $(':checkbox').each(function()
            {

            }
        }
    });
});

Have I made any mistakes?

Edit:

Okay so I have solve it. Here is the solution:

<script type="text/javascript">
$(function () {
    $("input[type='checkbox']").click(function () {

        var value = $(this).attr('value');

        if ($(this).is(':checked')) {

            var modules = FindModuleRules(value);

            $(':checkbox[value*="' + modules[0] + '"]').attr('disabled', true);
            $(':checkbox[value*="' + modules[1] + '"]').attr('disabled', true);
            $(':checkbox[value*="' + modules[2] + '"]').attr('disabled', true);
            $(':checkbox[value~="' + value + '"]').attr('disabled', false);

        }
        else {
            var modules = FindModuleRules(value);

            $(':checkbox[value*="' + modules[0] + '"]').attr('disabled', false);
            $(':checkbox[value*="' + modules[1] + '"]').attr('disabled', false);
            $(':checkbox[value*="' + modules[2] + '"]').attr('disabled', false);
        }
    });

    function FindModuleRules(string) {

        var modules = new Array();

        var bRegex = /B/;
        var lRegex = /L/;
        var aRegex = /A/;

        if (string.search(bRegex) != -1)
            modules[0] = "B";
        else
            modules[0] = "X";
        if (string.search(lRegex) != -1)
            modules[1] = "L";
        else
            modules[1] = "X";
        if (string.search(aRegex) != -1)
            modules[2] = "A";
        else
            modules[2] = "X";

        return modules;
    }

});

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T11:30:58+00:00Added an answer on June 6, 2026 at 11:30 am

    I have answered the question. Thanks for all the help.

    <script type="text/javascript">
    $(function () {
        $("input[type='checkbox']").click(function () {
    
            var value = $(this).attr('value');
    
            if ($(this).is(':checked')) {
    
                var modules = FindModuleRules(value);
    
                $(':checkbox[value*="' + modules[0] + '"]').attr('disabled', true);
                $(':checkbox[value*="' + modules[1] + '"]').attr('disabled', true);
                $(':checkbox[value*="' + modules[2] + '"]').attr('disabled', true);
                $(':checkbox[value~="' + value + '"]').attr('disabled', false);
    
            }
            else {
                var modules = FindModuleRules(value);
    
                $(':checkbox[value*="' + modules[0] + '"]').attr('disabled', false);
                $(':checkbox[value*="' + modules[1] + '"]').attr('disabled', false);
                $(':checkbox[value*="' + modules[2] + '"]').attr('disabled', false);
            }
        });
    
        function FindModuleRules(string) {
    
            var modules = new Array();
    
            var bRegex = /B/;
            var lRegex = /L/;
            var aRegex = /A/;
    
            if (string.search(bRegex) != -1)
                modules[0] = "B";
            else
                modules[0] = "X";
            if (string.search(lRegex) != -1)
                modules[1] = "L";
            else
                modules[1] = "X";
            if (string.search(aRegex) != -1)
                modules[2] = "A";
            else
                modules[2] = "X";
    
            return modules;
        }
    
    });
    

    I use the FindModuleRule function to sort through all the value strings and pick out key characters that only appear in certain values such as ‘A’, ‘L’, or ‘B’ if none is found then I assign to ‘X’ which is not found in any of the value strings. I then use that character to select all check boxes with values that contain the character and either switch them on or off depending and then switch the check box that was clicked to its appropriate state.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an object that I want to send with my jquery.ajax function but
I have a simple jQuery function that resizes text areas, and I want it
I have been looking for a function in jquery that will let me just
i have a jquery slider function and i want to customize it. my requirement
If I want to have a publicly accessible function on a jQuery plugin I'm
I have asp.net generated html code. I want execute jQuery click function when user
I have jquery with class= modal i want to call that class when page
I have a jquery accordion that I want to use nth-child to assign odd
I am trying to create a jQuery click function that will close a div
Ok so i have this Jquery that will toggle some radio buttons on the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.