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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T19:10:04+00:00 2026-06-02T19:10:04+00:00

I have an array of checkboxes that gets built from a smarty template. When

  • 0

I have an array of checkboxes that gets built from a smarty template. When a particular checkbox is selected with a value of WTOPS, I want this action to select all the other checkboxes in the div. Here is my code below which is not working

Here is my jquery:

$("input[name=levelCheck]").change(function () {
if ($("input[name=levelCheck]:checked").val() == 'WTOPS') {
$("input[type='checkbox']").attr('checked', true);  
}
});

Here is the HTML:

<div id="Women">
<label> <input type="checkbox" name="level_desc[]" id="levelCheck" value="WOPEN"> Open </label>
<label> <input type="checkbox" name="level_desc[]" id="levelCheck" value="WPREPOPT"> Prep Opt </label>
<label> <input type="checkbox" name="level_desc[]" id="levelCheck" value="WTOPS"> TOPS </label>
</div>
  • 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-02T19:10:06+00:00Added an answer on June 2, 2026 at 7:10 pm

    Below script should do the trick for the markup you have,

    DEMO

    $(function() {
        $("input[name=level_desc\\[\\]]").change(function() {        
            if ($("input[name=level_desc\\[\\]]:checked").val() == 'WTOPS') {
                $("input[type='checkbox']").attr('checked', true);
            }
        });
    });
    

    As Michael pointed out, using quotes looks better,

    $(function() {
        $("input[name='level_desc[]']").change(function() {        
            if ($("input[name='level_desc[]']:checked").val() == 'WTOPS') {
                $("input[type='checkbox']").attr('checked', true);
            }
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have constructed a array that gets the information from checkboxes. This is working
Hi I have an array of checkboxes e.g. <input type=checkbox name=checks[] value=1 /> <input
I have the following php array that gets all values from a form full
I have a asp.net mvc page with an array of checkboxes that gets posted
So I have an array that gets created from a php loop that looks
Within my Smarty template I have a series of checkboxes that are named region_codes,
I have an array of checkboxes that I edit at once to set up
I have an array (for checkboxes) that I need to pass alongside the regular
I am going nuts here, I have an array of checkboxes from a form
I have a list of checkboxes that I want to insert into a database,

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.