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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T18:52:22+00:00 2026-06-07T18:52:22+00:00

I am having trouble making a button that will check all the boxes (and

  • 0

I am having trouble making a button that will check all the boxes (and possibly another button that unchecks them all.

So what i need is: A function that will check all the boxes and a line of code to put into html to call that function.

My items are NOT in a form.

This is the code inside my .js file (array)

var computer = new Array();
{
computer[0] = "10001, Nvidia Geforce GTX 690, $1200"

computer[1] = "10002, Raedon HD 7950, $450"   

computer[2] = "20001, Ivy Bridge i7 3770, $400"

computer[3] = "20002, Ivy Bridge i7 3770k, $420"

computer[4] = "20003, Sandy Bridge i7 2700k, $340"

computer[5] = "20004, Bulldozer FX-8150, $270"

computer[6] = "30001, Antec eleven-hundred, $120"

computer[7] = "30002, Coolermaster HAF-X, $170"

computer[8] = "30003, Antec three-hundred, $50"

computer[9] = "30004, Corsair 550D, $160"

computer[10] = "40001, INTEL-ASrock fatal1ty Z77 Professional Motherboard, $250"

computer[11] = "40002, INTEL-ASrock Z77 extreme9 Motherboard, $350"

computer[12] = "40003, AMD-ASrock fatal1ty 990FX Professional Motherboard, $240"

computer[13] = "40004, AMD-ASUS Sabertooth 990FX Motherboard, $260"

}

This is the code inside my HTML.

<script type="text/javascript">

for(x=0; x<=computer.length-1; x++) {

  document.write("<tr id='"+x+"'><td><label><input type='checkbox' id='labeltest' name='item' value='"+x+"'/> "+computer[x].split(",")[0]+"</label></td><td>"+computer[x].split(",")[1]+"</td><td> <input name='qty' id='qty' type='textbox' value='0' onchange='qtychange(document.myform.qty);'/> </td><td>"+computer[x].split(",")[2]+"</td></tr>");

}

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-06-07T18:52:24+00:00Added an answer on June 7, 2026 at 6:52 pm

    Your checkboxes must have only the same “name” attribute, not “id” too, then use this function:

    function check() {
    
        var checkboxes = document.getElementsByName('item');
    
        for (var i = 0, length = checkboxes.length; i < length; i++) {
            checkboxes[i].checked = true;
        }
    }
    

    HTML:

    <button onclick="check()">Check them all!</button>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having trouble making this work: $(function() { $(.button).click(function() { var newentry = $(input#entry).val();
Im having trouble making sure my active graphic is positioned outside of the button,
I'm having some trouble with an iPhone app that I'm making. I have two
I am having trouble with making my button perform a click after a postback.
Maybe a simple question but I'm having alot of trouble making a button change
Im having trouble making my table contents vertically aligned and was wondering if you
I'm having trouble making divs top position be relative to its preceding subling. I
I'm having trouble making python print out texts properly aligned. I have tried everything
I'm having trouble making a secure FTP connection using SharpSSH. Up to now I've
I'm new to iOS development and I'm having trouble making a simple Json POST

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.