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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:29:56+00:00 2026-06-05T22:29:56+00:00

I have two checkboxes generated like this: <table> <?php foreach ($invited_members as $mem) :

  • 0

I have two checkboxes generated like this:

  <table>
    <?php foreach ($invited_members as $mem) : ?>
        <?php if ($mem['mc_role'] != 'c') : ?>
                            <tr>
                                <td style="width:40px;text-align:center"> attend  </td>
                             <td style="width:40px;text-align:center"><input name="p_members[]" id="p_members" type="checkbox"  value="<?php echo $mem['member_id']; ?>" <?php if ($mem['mm_present'] == 1) echo 'checked="checked"'; ?> <?php if (!$this->isSupervisor or $meeting_info['meeting_status'] != 2) echo 'disabled="disabled"';?> onclick="change(this,'#on_p_members');"/></td>
                              <td style="width:40px;text-align:center"> E-attend  </td>
                                <td style="width:40px;text-align:center"><input name="on_p_members[]" id="on_p_members" type="checkbox" value="<?php echo $mem['member_id']; ?>" <?php if ($mem['mm_present'] == 2) echo 'checked="checked"'; ?> <?php if (!$this->isSupervisor or $meeting_info['meeting_status'] != 2) echo 'disabled="disabled"'; ?>onclick="change(this,'#p_members');"/></td>
                                <td style="width:50px;text-align:center"><img src="<?php echo base_url() . 'avaters/' . $mem['mem_image']; ?>" height="38" width="38" /></td>
                                <td><?php echo stripslashes($mem['mem_real_name']); ?></td>
                            </tr>
        <?php endif; ?>
    <?php endforeach; ?>
                </table>

I want when the user check on one of the them the other on disabled so i tired using jquery

function change(p_members,x)
{


 if ($(p_members).attr('checked'))
     { 

         $(x).attr('checked',false);
         $(x).attr('disabled',true);

     }
     else 
         {               
              $(x).removeAttr('disabled');

         }
  }

But it didn’t work correctly. When the user in the second row check one the checkbox, one of the checkboxes on the row before it is disabled. How can I solve this ?

  • 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-05T22:29:58+00:00Added an answer on June 5, 2026 at 10:29 pm

    You can try this…

     $("input:checkbox").click(function () {
        $("input:checkbox").not($(this)).attr('disabled', 'disabled');
    });
    

    This is a general form. you can add parent of element or id to get desired checkbox list.

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

Sidebar

Related Questions

So my problem goes like this, I have two lists LIST A contains. Item
I have two checkboxes. I need to check that at least one of them
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
Here is my code, I have two checkboxes and want to keep one disabled
I have the following two code blocks. Code block 1 var checkboxes = $(div.c1
Brief: Based on a query, I have multiple checkboxes generated dynamically. The value of
I have two checkboxes: cb1 and cb2. They are both hooked up to an
I have two separately named checkboxes sending values to the following script. I seem
I have two methods that basically converts underlying checkboxes' text or tag as CSV

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.