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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:29:26+00:00 2026-06-18T01:29:26+00:00

Hello I am making a script to check all slave checkboxes related to master

  • 0

Hello I am making a script to check all slave checkboxes related to master checkbox. This will be done using classes. So master checkboxes will have classes like “master1”, “master2” etc.. The related slave checkboxes gonna have “slave1” class (related to master1), “slave2” (related to master2) etc..

so I’ll begin with:

jQuery('.checks_div input[type="checkbox"].^="master"').click(function(){

So when the master was clicked I want to choose all related slave and check them. But how?

Thanks

  • 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-18T01:29:27+00:00Added an answer on June 18, 2026 at 1:29 am
    $('input[type="checkbox"][class^="master"]').on("click",function(){})
    

    but delegating is better

    $(document.body).on('click','input[type="checkbox"][class^="master"]',function(){})
    

    then inside the click function & if you have your slaves in an adjacent div to the master checkbox

    var $slaves=$(this).next().find('input[type="checkbox"][class*="slave"]')
    

    if html is different well come out with a way to select those slaves from this $(this) that is the box just checked

    once your slaves are in a jquery object, to check them :

    $slaves.prop('checked', true);
    

    see Setting "checked" for a checkbox with jQuery?

    if you do nothing else than check them you don’t even need to cache your slaves in a jquery object

     $(this).//chain to select slaves
            .prop('checked', true)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making a class that will act as a facade into script loading. This
I was making this hello world application using Struts2 and I've encountered an HTTP
Hello I am having a hard time making this UI element look the way
Hello Android programmers, I am making a currency application and to do this, I
Hello I'm making a php script to extract videos URL from Youtube result. I
these day im making python script related with DOM. problem is these day many
Hello I'm making RSS reader and I'm using DOM. Now I stuck, trying to
Hello i am making grid menu for activity , all things are working well
Thanks for all the great answers, this helps a lot! Hello, I need some
I am making a cross domain request using script tag hack and jsonp. In

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.