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 6774239
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:45:48+00:00 2026-05-26T15:45:48+00:00

We have checkboxes in two columns (they denote the same category, but different subscription)

  • 0

We have checkboxes in two columns (they denote the same category, but different subscription)

We would like to limit the selection to 4. We have a jQuery code to disable the checkbox selection after the user selected 4.

But now we need to have the following logic:

  • Allow the user to choose both values from the same rows (aka: subscribe to both subscriptions from the same category) and do not count in the 4 limit we have if they have chosen more from the same row.

So if you look in the following screencast, we would like to be able to select the first checkbox (1st row).

enter image description here

The code we used was:

$("input:checkbox").click(function() {

  var bol = $("input:checkbox:checked").length >= 4;     
  $("input:checkbox").not(":checked").attr("disabled",bol);

});

A jsFiddle has been created to reflect the current state of work:
http://jsfiddle.net/fFbLx/

Feel free to name the classes, inputs as you wish.

  • 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-05-26T15:45:48+00:00Added an answer on May 26, 2026 at 3:45 pm

    I think you would have to “categorise” them by the LI then. So count the LI’s with an checked box – disable all others if more than 4 active.

    See: http://jsfiddle.net/fFbLx/4/ (maybe give the UL’s a class, so you can use the selector on that)

    $("input:checkbox").click(function() {
    
      var counter = 0;
        $('li').each( function() {
            if($(this).find("input:checkbox:checked").length)
            {
                $(this).addClass('active');
                counter++;
            } else {
                $(this).removeClass('active');
            }
        });
      var bol = counter >= 4;     
      $('li').not('.active').find("input:checkbox").not(":checked").attr("disabled",bol);
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some checkboxes dynamically created in C# codebehind. Let's say two columns. This
I have two columns one for id & other for checkboxes. i have taken
I have two columns of checkboxes with a select all checkbox at the bottom
I have two checkboxes (Recommended and Others) which have peoples names (concatenated, i.e. John
I have two CheckBoxes and a TextBox. I want to TextBox to have IsEnabled=False
I have the following two code blocks. Code block 1 var checkboxes = $(div.c1
I have three checkboxes like ch[0], ch[1] and ch[3] (sometimes i have more, or
Please see coments in js code. I have two checkboxes <input type=checkbox name=first id=first
There is a WPF DataGrid with columns that have checkboxes. These checkboxes are already
I have two tables [Source: table1, Destination:table2] with 3 columns each (checkbox, value1, value2).

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.