Creating a page that features multiple checkboxes, some nested and others not. When a particular checkbox is selected, additional options will be displayed underneath it for selection; if unchecked, the child boxes will be hidden. Currently, this functionality is achieved solely with CSS. The goal is for checking a parent box to reveal the child options without automatically checking them. The user selects the desired boxes and submits the values, including those in the parent checkboxes. However, when any of the parent boxes are unchecked, the children should also be unchecked. Below is the code snippet for reference.
input {
position: absolute;
left: -9999px;
}
label {
display: block;
padding: 15px 30px 15px 15px;
border: 3px solid #fff;
border-radius: 100px;
color: #fff;
background-color: #6a8494;
box-shadow: 0 0 20px rgba(0, 0, 0, .2);
white-space: nowrap;
user-select: none;
transition: background-color .2s, box-shadow .2s;
width: 300px;
}
...
...
Currently, unchecking the first option hides the other checkboxes while they remain visually "checked." Efforts are being made to synchronize the visibility of options with their checked status.