I have two checkboxes that when clicked I want to show an additional 3 checkboxes. I've done this by hiding the div in HTML, and then using css to display the div when clicked (code attached).
For some reason though, whenever I click the first checkbox (snapshot_checkbox
), the sub-option checkboxes open for the second checkbox as well as this one (the second checkbox being tmd_checkbox
. How do I prevent this? I want them to both only open their respective sub-options, not each others as well. I hope this makes sense.
ul input:checked~#snapshot_suboptions {
display: inline;
}
ul input:checked~#tmd_suboptions {
display: inline;
}
<div class="selectproduct">
<h1>3. Select Product</h1>
<ul>
<li>
<input type="checkbox" class="product" name="snapshot" value="0.09" id="snapshot_checkbox" onclick="SnapshotFunction()">Snapshot (Targetoo)<br>
<div id="snapshot_suboptions" class="hidden">
<ul>
<li><input type="checkbox" name="banner" value="0.08" id="snapshot_banner_checkbox">Banner<br></li>
<li><input type="checkbox" name="video" value="0.08" id="snapshot_video_checkbox">Video<br></li>
<li><input type="checkbox" name="richmedia" value="0.08" id="snapshot_richmedia_checkbox">Rich Media<br></li>
</ul>
</div>
<input type="checkbox" class="product" name="targetedmobiledisplay" value="0.08" id="tmd_checkbox"> Targeted Mobile Display<br>
<div id="tmd_suboptions" class="hidden">
<ul>
<li><input type="checkbox" name="banner" value="0.08" id="tmd_banner_checkbox">Banner<br></li>
<li><input type="checkbox" name="video" value="0.08" id="tmd_video_checkbox">Video<br></li>
<li><input type="checkbox" name="richmedia" value="0.08" id="tmd_richmedia_checkbox">Rich Media<br></li>
<br>
</ul>
</div>
<input type="checkbox" class="product" name="push" id="push_checkbox" value="0.07">Push (ZeroPark)<br>
<input type="checkbox" class="product" name="behaviouralpush" id="behaviouralpush_checkbox" value="0.07">Behavioural Push (Airpush)<br>
<input type="checkbox" class="product" name="mobileoverlay" id="mobileoverlay_checkbox" value="0.06">Mobile Overlay<br>
<input type="checkbox" class="product" name="landingpage" value="0.08">Landing Page<br>
<input type="checkbox" class="product" name="video" value="0.07" id="video_checkbox">Video<br>
<p id="video_text" style="display:none">Video will be sold on a CPCV (Cost per Completed View) basis, NOT CPC. This is the industry standard for video advertising.</p>
</li>
</ul>
</div>
Aucun commentaire:
Enregistrer un commentaire