samedi 4 juin 2016

Checked/unchecked parent checkbox hide/unhide children checkboxes. I need to also clear the children checkboxes and reset radio button to default

To hide and unhide the checkboxes.

function showMe (it, box) {
  var vis = (box.checked) ? "block" : "none";
  document.getElementById(it).style.display = vis;
}

The parent and children checkboxes and radio buttons.

<form>
    <input type="checkbox" name="F1" onclick="showMe('div2', this)" />7th Floor
</form>
<div id="div2" style="display:none">
<br/>
<table>
    <tr>
    <td width="600px"><label><input type="checkbox" name="building" />Support Services</label></td>
    <td><label><input type="radio" name="timeFrame1" checked="checked" />6 to 6</label></td>
    <td><label><input type="radio" name="timeFrame1" />24/7</label></td>
    </tr>
</table>




Aucun commentaire:

Enregistrer un commentaire