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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:09:20+00:00 2026-06-05T02:09:20+00:00

Question: I have a category listing which some categories have children, I am trying

  • 0

Question:

I have a category listing which some categories have children, I am trying to create a ALL category that when clicked, will check all sibling checkboxes in that same category.

e.g; clicking ALL underneath the MUSIC category would check blues, jazz, rock n roll

Code:

HTML:

<ul name="events-categories" id="events-categories">
    <li><input type="checkbox" name="category-events" value="185" placeholder="" id="category-185" class="events-category"> CONVENTIONS
        <ul class="event-children">
            <li><input type="checkbox" name="child-category-all" value="" class="events-child-category-all">ALL</li>
            <li><input type="checkbox" name="child-category-190" value="190" id="child-category-190" class="child events-child-category">SCIENCE</li>
            <li><input type="checkbox" name="child-category-191" value="191" id="child-category-191" class="child events-child-category">TECHNOLOGY</li>
        </ul>
    </li>
    <li><input type="checkbox" name="category-events" value="184" placeholder="" id="category-184" class="events-category"> MUSIC
        <ul class="event-children">
            <li><input type="checkbox" name="child-category-all" value="" class="events-child-category-all">ALL</li>
            <li><input type="checkbox" name="child-category-189" value="189" id="child-category-189" class="child events-child-category">BLUES</li>
            <li><input type="checkbox" name="child-category-188" value="188" id="child-category-188" class="child events-child-category">JAZZ</li>
            <li><input type="checkbox" name="child-category-187" value="187" id="child-category-187" class="child events-child-category">ROCK N ROLL</li>
        </ul>
    </li>
    <li><input type="checkbox" name="category-events" value="186" placeholder="" id="category-186" class="events-category"> TRIBUTES</li>
</ul>​

CSS:

.event-children {
    margin-left: 20px;
    list-style: none;
    display: none;
}​

jQuery So Far:

/**
 * left sidebar events categories
 * toggle sub categories
 */
$('.events-category').change( function(){
    console.log('showing sub categories');
    var c = this.checked;
    if( c ){
        $(this).next('.event-children').css('display', 'block');
    }else{
        $(this).next('.event-children').css('display', 'none');
    }
});

$('.events-child-category-all').change( function(){
    var c = this.checked;
    if( c ){
        $(this).siblings(':checkbox').attr('checked',true);
    }else{
        $(this).siblings(':checkbox').attr('checked',false);
    }
});​

jsfiddle: http://jsfiddle.net/SENV8/

  • 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-05T02:09:22+00:00Added an answer on June 5, 2026 at 2:09 am
    $('.events-child-category-all').change( function(){
        $(this).parent().siblings().find(':checkbox').attr('checked', this.checked);
    });​
    

    http://jsfiddle.net/SENV8/3/

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

Sidebar

Related Questions

I have list of categories , some have sub-category and some have sub-sub-category which
Given a set of questions that have linked survey and category id: > db.questions.find().toArray();
Question: I have to create a tablet application. In this i want to make
I have question. I have some app on facebook and getting this error Fatal
I have a question about MVC. Particularly about models. Suppose that I have a
I am developing a web application about books. We all knows that books have
In my code I have a Category model which has many subcategories, and the
This is SQL Server Question I have a set of categories, and their relationship
I have a question regarding an update function I created... CREATE OR REPLACE FUNCTION
I have a question. I need to save all values of my model. Class

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.