Verifying checked checkboxes

Verifying checked checkboxes

In an html site, I have several checkboxes named either "chidecb" or "coptions".
  1. <div id="info" style="width: 300px; height: 400px; float:left; margin: 5px;">
        <input type="checkbox" name="chidecb">
            <input type="checkbox" name="coptions" value="dit">
            <input type="checkbox" name="coptions" value="kin">
            <input type="checkbox" name="coptions" value="mus">
        <input type="checkbox" name="chidecb">
        <input type="checkbox" name="chidecb">
            <input type="checkbox" name="coptions" value="BAS">
            <input type="checkbox" name="coptions" value="SBF">
            <input type="checkbox" name="coptions" value="SBH">
            <input type="checkbox" name="coptions" value="SKB">
        <input type="checkbox" name="chidecb">
            <input type="checkbox" name="coptions" value="bws">
            <input type="checkbox" name="coptions" value="bur">
            <input type="checkbox" name="coptions" value="kkd">
            <input type="checkbox" name="coptions" value="klt">
            <input type="checkbox" name="coptions" value="pls">
            <input type="checkbox" name="coptions" value="sls">
        <input type="checkbox" name="chidecb">
    </div>



















Now here's my question: How can I build an array with the values from "coptions", in which by
checking "chidecb", the subordinate checkboxes "coptions" will also be checked.
Here's what I've already got:

  1. $(document).ready(function()
    {   
        var mca = '';
        $(".coption").click( function ()
        {
            for(i=0;i<document.forms[0].elements['coptions'].length;i++)
            {
                if(document.forms[0].elements['coptions'][i].checked)
                {
                    mca += document.forms[0].elements['coptions'][i].value + ',\n';
                }
            }
            alert(mca);
            mca = '';
        });
    });















The end result should be something like kin, mus, SKB
And if possible, the code should be jQuery
It would be great if anyone could help me.

Thx, rodeostar