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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T00:21:43+00:00 2026-05-20T00:21:43+00:00

I am using a checkbox that has the name as selectedids[] and I am

  • 0

I am using a checkbox that has the name as “selectedids[]” and I am trying to select all checkboxes with the JavaScript. The code is not working. When I change the name of the checkbox to “selectedids” it works, but I can’t do so because I need all the ids that are selected on the POSTED page.

The checkbox is as follows:

foreach($rows as $row)
{
<input type="checkbox" name="selectedids[]" value="<?php echo $row['id']; ?>" class="checkbox" />
........
........
}

And the Java-script function is as follows:

function SetAllCheckBoxes(CheckValue)
{
    var CheckValue=true;
    if(!document.forms['main'])
        return;
    var objCheckBoxes = document.forms['main'].elements['selectedids[]'];
    if(!objCheckBoxes)
        return;
    var countCheckBoxes = objCheckBoxes.length;
    if(!countCheckBoxes)
        objCheckBoxes.checked = CheckValue;
    else
        // set the check value for all check boxes
        for(var i = 0; i < countCheckBoxes; i++)
            objCheckBoxes[i].checked = CheckValue;
}

Please help me……

Thanks in advance…….

  • 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-05-20T00:21:43+00:00Added an answer on May 20, 2026 at 12:21 am

    Do you have the option to use jQuery? If so, then you could do something like:

    $(':checkbox').each(function(){
      $(this).attr('checked',true);
    });
    

    It also might work to try:

    $(':checkbox').attr('checked',true);
    

    Or, if you just want to make sure all the boxes are checked only when the page first loads you could have your php that creates the checkboxes include “CHECKED”. i.e.

    <input type='checkbox' name='selectedids[]' value='value' CHECKED>
    

    Updated to use :checkbox per comment

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

Sidebar

Related Questions

I have a gridview that I have added a checkbox column using a templatefield
I am using Html.CheckBox() . The resulting HTML is: <input id=IsMultiGraph name=IsMultiGraph value=true type=checkbox>
Using preview 4 of ASP.NET MVC Code like: <%= Html.CheckBox( myCheckBox, Click Here, True,
I am using asp.net and I am trying to save checkbox values into a
can anybody show me how to build a string using checkbox. what would be
I'd like to do something like this to tick a checkbox using jQuery :
Is there a specific reason why I should be using the Html.CheckBox , Html.TextBox
Using ASP.NET MVC there are situations (such as form submission) that may require a
Im trying to pass the name of a global variable to a sub routine
Level: PHP Learner I'm stuck with a checkbox problem. I have a db that

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.