Animaze
asked on
Toggle Show/Hide Element that is sibling of Checkbox with JQuery
Hi,
Looking for a JQuery solution to this -
I have a series of HTML checkboxes and each has a hidden element (<ul class="product-status-opti ons-contro ls">) associated with it. When a checkbox is checked I would like to show the element associated with that checkbox, while the others remain hidden. If another checkbox is selected the current hides and the new one is visible.
Below is the basic HTML. So, on page load, the "product-status-options-co ntrols" class is hidden. When a checkbox under the class "product-status-options" is checked, that checkbox's corresponding "product-status-options-co ntrols" element is visible. It will hide again if another checkbox is selected and the new checkbox's "product-status-options-co ntrols" element becomes visible.
Looking for a JQuery solution to this -
I have a series of HTML checkboxes and each has a hidden element (<ul class="product-status-opti
Below is the basic HTML. So, on page load, the "product-status-options-co
<form action="#" method="post">
<fieldset>
<legend>Add Product</legend>
<ul class="product-status-options">
<li>
<input type="checkbox" name="status_welcome" id="status_welcome" value="1" />
<label for="status_welcome">Welcome</label>
<ul class="product-status-options-controls">
<li>
<label for="status_welcome_notes">Note:</label><br />
<textarea name="status_welcome_notes" id="status_welcome_notes" cols="25" rows="4"></textarea>
</li>
<li>
<input type="submit" value="Update"/>
</li>
</ul>
</li>
<li>
<input type="checkbox" name="status_preproduction" id="status_preproduction" value="1" />
<label for="status_preproduction">Pre-Production</label>
<ul class="product-status-options-controls">
<li>
<label for="status_preproduction_notes">Note:</label><br />
<textarea name="status_preproduction_notes" id="status_preproduction_notes" cols="25" rows="4"></textarea>
</li>
<li>
<input type="submit" value="Update"/>
</li>
</ul>
</li>
<li>
<input type="checkbox" name="status_production" id="status_production" value="1" />
<label for="status_production">Production</label>
<ul class="product-status-options-controls">
<li>
<label for="status_production_notes">Note:</label><br />
<textarea name="status_production_notes" id="status_production_notes" cols="25" rows="4"></textarea>
</li>
<li>
<input type="submit" value="Update"/>
</li>
</ul>
</li>
<li>
<input type="checkbox" name="status_shipped" id="status_shipped" value="1" />
<label for="status_shipped">Shipped</label>
<ul class="product-status-options-controls">
<li>
<label for="status_shipped_notes">Note:</label><br />
<textarea name="status_shipped_notes" id="status_shipped_notes" cols="25" rows="4"></textarea>
</li>
<li>
<input type="submit" value="Update"/>
</li>
</ul>
</li>
</ul>
</fieldset>
</form>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Thank you and you are most welcome
ASKER