• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
  • Piet Souris
  • Himai Minh

How to get a checkbox list using javascript?

Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi folks!

I'm developing a web application and there is an html form which contains a table with four columns. At the first column, I put checkboxes which allow the user remove the items specified on the second column. Moreover, each item may contain more than one subitem. So, at the third column I put checkboxes which allow the user remove the subitems specified on the forth column.

The first column checkboxes are named as "removeItem".
The third column checkboxes are names as "removeItem" + index of the item + "SubItem".

If the user check the checkbox of the first column, all subitems checkboxes related with the selected checkbox item must be checked.

The problem is that I don't know how to obtain the checkboxes of the third column when the first column checkbox is checked.

Someonde knows an solution for this problem?

Jo´┐Żo Cunha

I writed an javascript using the document.getElement() method, but it didn't wotk. It follows the code:

function selectItem(itemIndex) {
var items = document.teamForm.removeItem;
var subItems = document.getElementById("removeItem" + itemIndex + "SubItem");
if (items.length > 0) {
if (teamMember[teamMemberIndex].checked) {
else {
else {
if (teamMember.checked) {
else {

The methods checkAll and clearAll check and uncheck, respectively, all the checkboxes from a list
My favorite is a chocolate cupcake with white frosting and tiny ad sprinkles.
Free, earth friendly heat - from the CodeRanch trailboss
    Bookmark Topic Watch Topic
  • New Topic