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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:51:03+00:00 2026-06-13T10:51:03+00:00

So basically I have a bunch of checkboxes on my page: <input type=checkbox id=check

  • 0

So basically I have a bunch of checkboxes on my page:

<input type="checkbox" id="check" name="1">
<input type="checkbox" id="check" name="2">
<input type="checkbox" id="check" name="3">

Now I need a javascript code to detect if a checkbox has been checked and then do something based on the name, I have this:

$('#check').click(function()...

But that only handles one checkbox and doesn’t work if I have more than one like above. I will possibly have alot of them so I would rather not check them one by one, any help would be greatly appreciated, thanks guys!

  • 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-13T10:51:04+00:00Added an answer on June 13, 2026 at 10:51 am

    You are binding the click with id and all the three control have same id. You need to give the unique id to html control you better assign a common class to group them. I have changed the ids of checkboxes to make them unique.

    <input type="checkbox" id="check1" name="1" class="someclass">
    <input type="checkbox" id="check2" name="2" class="someclass">
    <input type="checkbox" id="check3" name="3" class="someclass">
    
    
    $('.someclass').click(function()...
    

    To check the checked checkboxes

    Live Demo

    $('#btn').click(function() {
        $('.someclass').each(function() {
           alert("checkbox id =" + this.id + " checked status " + this.checked);
        });
    });​
    

    To check a group of checkbox on change of other checkbox

    Live Demo

    <input type="checkbox" id="check1" name="1" class="someclass">
    <input type="checkbox" id="check2" name="2" class="someclass">
    <input type="checkbox" id="check3" name="3" class="someclass">
    <label> <input id="chkall" type="checkbox" text=""aa /> check all </label>
    ​
    
    $('#chkall').click(function() {
        $('.someclass').attr('checked', this.checked);
    });​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page that will basically be used to concatenate a bunch of
I have a bunch of javascript files I need to parse via PHP (I
I'm getting confused by pointers in objective-c. Basically I have a bunch of static
So basically, I have a bunch of TextBoxes that the user gets to fill
have one time consuming step that flattens a bunch of files. basically i'd like
I basically have 7 select statements that I need to have the results output
I have a bunch of tick boxes that need to be inserted into one
I am creating a GridView/DetailsView page. I have a grid that displays a bunch
Basically I have a getjson call to call for a bunch load of data.
I have a bunch of methods that make use of jquery to basically generate

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.