简体   繁体   中英

Group checkboxes do not show checked

I have a group of checkboxes and a toggle button to check/uncheck al checkboxes within this group. The function associated with the button puts the value associated with each check box in another table. When the button is clicked, the function works fine, but the checkboxes do not display the check sign even when the button is clicked. Here is the code:

function selRemChecks(aDivId,buttonId){
    var myDiv = dojo.byId(aDivId).getElementsByTagName("tr");
    for (j=0;j<myDiv.length;j++){
        myDiv[j].childNodes[3].childNodes[0].firstChild.checked=dojo.byId(buttonId).checked;
    }
    if (dojo.byId(buttonId).checked==true){
        dijit.byId(buttonId).set("label", "Clear group");
    }
    else if (dojo.byId(buttonId).checked==false){
        dijit.byId(buttonId).set("label", "Select group");
    }
}

Please suggest me a solution.

I have added my HTML code here:

<div data-dojo-type="dijit.form.Form" id="group1AForm" name="group1AForm">
<div dojoType="dijit.TitlePane" id="group1A" title="Population projection" open="false">
<table id="popIndTableA">
<tr id="testing">
<td id="indCBRA">Crude Birth Rate</td>
<td id="testing2"><input data-dojo-type="dijit.form.CheckBox" class="check1A" id="checkCBRA" name="checkCBRA" /></td>
<td id="infoCBRA"><img id="imgCBRA" src="Images/help_icon2.png"  width="16px" onClick="" /></td>
</tr>
<tr>
<td id="indTestA1">Test 1</td>
<td><input data-dojo-type="dijit.form.CheckBox" class="check1A" id="checkTestA1" name="checkTestA1" /></td>
<td id="infoTestA1"><img id="imgTestA1" src="Images/help_icon2.png"  width="16px" onClick="" /></td>
</tr>
<tr>
<td id="indTestA2">Test 2</td>                
<td><input data-dojo-type="dijit.form.CheckBox" class="check1A" id="checkTestA2" name="checkTestA2" /></td>
<td id="infoTestA2"><img id="imgTestA2" src="Images/help_icon2.png"  width="16px" onClick="" /></td>
</tr>
</table>
</div>
<div dojo-data-type="dijit.form.Form" id="selectGrp1A" name="selectGrp1A">
<button dojoType="dijit.form.ToggleButton" iconClass="dijitCheckBoxIcon" id="selGrp1A" onclick="selRemChecks('group1A',this.id); ">Select group </button>
</div>
</div>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM