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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:45:27+00:00 2026-06-03T04:45:27+00:00

<label class=checkbox inline> <input type=checkbox name=Services[] value=service1> Service 1 </label> <label class=checkbox inline> <input

  • 0
<label class="checkbox inline">
<input type="checkbox" name="Services[]" value="service1"> Service 1
</label>
<label class="checkbox inline">
<input type="checkbox" name="Services[]" value="service2"> Service 2
</label>

I am using Services[] so that $_POST[‘Services’] is mapped to an array in PHP, containing the values required.

However, on the client side I also need to uncheck all these checkboxes after the form has been submitted (to PHP). Fairly simple Javascript: (actual checkbox group is 8 long).

for (j=0; j<8; j++){
fields[6][j].checked=false;
}

where:

fields[6] = formob.Services[];
formob=document.forms["FooterQuote"];

The problem is that I cannot put Services[] into a Javascript array. I have tried using the following methods: (pseudo-code, only syntax matters here)

var fields=[formob.text1, formob.text2, formob.text3, formob.Services[]];
//Syntax error at Services[]

var fields=new Array(formob.text1, formob.text2, formob.text3, formob.Services[]);
//Syntax error at Services[]

var fields=new Array(formob.text1, formob.text2, formob.text3);
fields.push(formob.Services[]);
//Syntax error at Services[]

So, unfortunately I can’t push Services[] into a Javascript array, as far as I can tell.

I have also tried using formob.Services instead, and this doesn’t work either.

Has anybody got any ideas how I can make the name=”Services[]” syntax for checkboxes work in a Javascript array, so I can cycle through and uncheck them all? 🙂

  • 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-03T04:45:28+00:00Added an answer on June 3, 2026 at 4:45 am

    You have to address to checkboxes like this:

    var services = ​document.forms['FooterQuote']['Services​[]']​;
    

    Have a look at this article for details: Dot and Square Bracket Notations.

    So to uncheck it use:

    for (var i = 0; i < services.length; i++) {
        services[i].checked = false;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

<label>Search: <input type=text aria-controls=company></label> Using Datatables , how would i added a class to
<label>Hatchback <input type=checkbox name= /></label> <label>Bike <input type=checkbox name= /></label> <label>Sedan <input type=checkbox name=
I have an Element Like <div class=control> <label>&nbsp;</label> <input type=checkbox id=1><span class=controlText>Check Box</span> <div
I have input checkbox <label for=edit-panes-uc-termsofservice-agreement-checkout-tos-agree-agreed class=option><input type=checkbox class=form-checkbox value=agreed id=edit-panes-uc-termsofservice-agreement-checkout-tos-agree-agreed name=panes[uc_termsofservice_agreement_checkout][tos_agree][agreed]> I agree
I have the following two checkbox groups: <fieldset class=CbxGroup> <legend>Checkbox Group (required)</legend> <label><input type=checkbox
I made a form class in c# that has a devexpress grid, a label
I'm trying to create some Menu Item with Image & Label, using barry's class
I want to add a class to my label of my checkbox if it's
I am trying to add a class to a label of a checkbox on
$('.answerlabel').click(function() { $(this).siblings('.answer').find('input:checkbox').attr(checked,checked); }); There answer is one class and answerlabel another class.Both will

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.