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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:18:34+00:00 2026-06-10T04:18:34+00:00

I have a problem disabling/enabling a set of checkboxes based on one single checkbox

  • 0

I have a problem disabling/enabling a set of checkboxes based on one single checkbox button. I’m using struts 2 with JQuery. I have 9 checkboxes:

<tr>
  <td><s:checkbox id="chkMain" name="Anywhere"/><s:property value="getPositionLabel('ANYWHERE')" /></td>
</tr>
<tr>
  <td><s:checkbox name="system"/><s:property value="getPositionLabel('SYSTEM')" /></td>             
  <td><s:checkbox name="author"/><s:property value="getPositionLabel('AUTHER')" /></td>
</tr>
<tr>
  <td><s:checkbox name="function"/><s:property value="getPositionLabel('FONCTION')" /></td>
  <td><s:checkbox name="reference"/><s:property value="getPositionLabel('REFERENCE')" /></td>
</tr>
<tr>
  <td><s:checkbox name="constructor"/><s:property value="getPositionLabel('CONSTRUCTOR')" /></td>                                                     
  <td><s:checkbox name="content"/><s:property value="getPositionLabel('CONTENT')" /></td>
</tr>
<tr>
  <td><s:checkbox name="materiel"/><s:property value="getPositionLabel('MATERIEL')" /></td>
  <td><s:checkbox name="title"/><s:property value="getPositionLabel('TITLE')" /></td> 
  <td>&nbsp;</td>
</tr>

When the checkbox button “Anywhere” is selected, all the other checkboxes are disabled.
and when it is de-selected, then all the other checkboxes are enabled.

How can this behaviour be acheived using jquery?

  • 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-10T04:18:36+00:00Added an answer on June 10, 2026 at 4:18 am

    Something like this:

    $("#chkMain").click(function() {
        $('input[type="checkbox"]').not(this).prop("disabled", this.checked);
    });
    

    That is, when chkMain is clicked, select all the checkboxes on the page except that one and set their disabled property to matched the checked status of chkMain.

    If you have other checkboxes on the page that should not be part of this functionality you’d need to make the selector more specific, e.g., if the relevant ones are all in some containing object such as that table:

    $('#idOfTable input[type="checkbox"]').not(this).prop("disabled", this.checked);
    

    Or you could give them all a common class, in which case you could omit the .not(this) part:

    $('input.someClass').prop("disabled", this.checked);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a problem with my jquery code which is disabling all the text
I have a problem, with disabling a input button with javascript in a aspx
i have created a slideshow, using jquery which has fade effect, the problem with
I have problem with my query on C, I’m using the oci8 driver. This
I have problem with tooltips on my magento website, I need to have one
I have a strange problem with PHP and cURL using windows. If have a
I have a problem disabling validation of the connection in Apache::DBI . From the
I have a problem with disabling JavaScript minifier in Liferay 5.2.3. I tried the
I have a problem, I need to retrieve a single field from a single
I asked this question previously: Disabling and Re-Enabling Dynamic Form Elements with JQuery but

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.