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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T00:52:25+00:00 2026-05-13T00:52:25+00:00

i have an check boxlist with (6 items under it). and i have an

  • 0

i have an check boxlist with (6 items under it). and i have an search button. if user clicks Search button it gets all the result.
i am binding the items for checkboxlist using database in .cs file

condition1:
but now if user selects a checkbox[item1] its gets selected
and he tries to select an 2 checkbox[item2] then firstselected checkbox[item1] should be unselected. only checkbox[item2] should be selected

condition 2:
now if user as selected checkbox1 [item1] it gets selected. and now if user again clicks on checkboxi[item1] then it should get deselected.

either you can provide me the solution in javascript or JQuery
any help would be great . looking forward for an solution
thank you

  • 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-13T00:52:25+00:00Added an answer on May 13, 2026 at 12:52 am

    While I definitely agree with the consensus that radio buttons are the way to go for your described use-case, here is a little snipped of jquery that will cause checkboxes to behave like radio buttons. You simply need to add a “groupname” attribute to your checkbox tag.

    HTML:

    <fieldset>
    <legend>Group 1 - radio button behavior</legend>
    <input type="checkbox" groupname="group1" value="1" /> Checkbox 1<br />
    <input type="checkbox" groupname="group1" value="2" /> Checkbox 2<br />
    <input type="checkbox" groupname="group1" value="3" /> Checkbox 3<br />
    <input type="checkbox" groupname="group1" value="4" /> Checkbox 4<br />
    <input type="checkbox" groupname="group1" value="5" /> Checkbox 5<br />
    </fieldset>
    
    
    <fieldset>    
    <legend>Group 2 - radio button behavior</legend>
    <input type="checkbox" groupname="group2" value="1" /> Checkbox 1<br />
    <input type="checkbox" groupname="group2" value="2" /> Checkbox 2<br />
    <input type="checkbox" groupname="group2" value="3" /> Checkbox 3<br />
    <input type="checkbox" groupname="group2" value="4" /> Checkbox 4<br />
    <input type="checkbox" groupname="group2" value="5" /> Checkbox 5<br />
    </fieldset>
    
    <fieldset>    
    <legend>Group 3 normal checkbox behavior</legend>
    <input type="checkbox" value="1" /> Checkbox 1<br />
    <input type="checkbox" value="2" /> Checkbox 2<br />
    <input type="checkbox" value="3" /> Checkbox 3<br />
    <input type="checkbox" value="4" /> Checkbox 4<br />
    <input type="checkbox" value="5" /> Checkbox 5<br />
    </fieldset>
    

    Javascript:

        <script type="text/javascript">
        $(document).ready(function() {
            $('input[type=checkbox]').click(function() {
            var groupName = $(this).attr('groupname');
    
                if (!groupName)
                    return;
    
                var checked = $(this).is(':checked');
    
                $("input[groupname='" + groupName + "']:checked").each(function() {
                    $(this).prop('checked', '');
                });
    
                if (checked)
                    $(this).prop('checked', 'checked');
            });
        });
    </script>
    

    I’m sure there are opportunities to increase brevity and performance, but this should get you started.

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

Sidebar

Related Questions

I have a checkboxlist in Popup. I used a selectall checkboxlist items function in
I have a check box list in that user can check or uncheck the
I have a checkboxlist.When I check one the value will appear in a table.Now
I have a Web User Control that contains a CheckBoxList. MyListControl: <asp:checkboxlist id=chkList runat=server>
Im using LINQ to retrive cheched Items from CheckBoxList control: Here the LINQ :
Hey there, i got this very annoying problem: I have a CheckBoxList getting items
Hey, I have a CheckBoxList that gets populated with the database. When I make
I have an <asp:CheckBoxList> using RepeatLayout=Flow in my page I dynamically assign values to.
i have a CheckBoxList with a list of services that the user can execute...
I have a CheckBoxList where users can select multiple items from the list. I

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.