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

  • Home
  • SEARCH
  • 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 8415089
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T01:20:47+00:00 2026-06-10T01:20:47+00:00

I am trying to create a select all, unselect all options like we see

  • 0

I am trying to create a select all, unselect all options like we see in email inboxes for a group of checkboxes. I have added an example for this. The working model that I am trying to get is when a I click on checkbox, it should select and unselect that group with a particular value. Also even if we uncheck any single name form the list, it should uncheck the main “select all” checkbox. I’ve added a jsfiddle, but it doesnt work properly.

$(document).ready(function(){
    $("#selectAll").live("click",function(e){
        e.preventDefault();
        e.stopImmediatePropagation();
        var clickedValue=$(this).attr('class');
        clickedValue=clickedValue.replace("select", "");
        $("#modalEntity").attr("value", "group"+ clickedValue).attr("checked", true);      
    });
});

http://jsfiddle.net/EBxSu/

  • 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-10T01:20:48+00:00Added an answer on June 10, 2026 at 1:20 am

    I updated your code a bit removing multiple IDs and handling the various scenario requested (clearing the select all check box if user selects a child). Also updated your jQuery using .on() rather than .live().

    jQuery looks like:

    $(function(){
      $('.selectAll').on('click', function(evt){
        var group = $(this).attr('data-group'),
            isChecked = !!($(this).prop('checked'));
        $('input[value="' + group + '"]').prop('checked', isChecked);    
      })
    
      $('.entity').on('click', function(evt){
        var group = $(this).attr('value'),
            siblings = $('input[value="' + group + '"]'),
            isChecked = true;
        siblings.each(function(idx, el){
          if(!$(el).prop('checked')) {
            isChecked = false;
            return;
          }
        })
        $('.selectAll[data-group="' + group + '"]').prop('checked', isChecked);
      })
    })
    

    And the updated HTML:

    <ul>
    <li>
    Country
    <ul>
    <input type="checkbox" class="selectAll" data-group="group1">Select/Deselect All Country
    <li>
    <input class="entity" type="checkbox" value="group1" name="India">India
    <input class="entity" type="checkbox" value="group1" name="UAE">UAE
    ...
    </ul>
    </li>
    </ul>
    

    Here’s the fiddle:
    http://jsfiddle.net/nBh4L/2/

    Thanks!
    Jack

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

Sidebar

Related Questions

Im trying to create a select command to query the database I have and
I have a DataGridView with a checkbox column. I'm trying to create a select/deselect
I'm trying to select all records that have a duplicate value in the LASTNAME
I am trying to select all the records from a sqlite db I have
I am trying to create a select element that has a list of numbers
I am trying to create two select lists both filled with the same times.
I am trying to create a select list starting from the current date of
I'm new to this so bear with me. I'm trying to create a select
I'm trying to create a custom SELECT query to find my Personal Best races
Trying to create Database as follows: USE Master GO IF NOT EXISTS(SELECT [Name] FROM

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.