I have a container (#main_Container) that holds multiple forms. Each form is within it's own container( .module ). Within each of the (.module) containers, I have 2 icons which need to be able to expand and collapse their form. However, I cannot get them to act on their parent container. Every time I click expand or contract, all forms are affected.
<script>
$(document).ajaxSuccess(function () {
$("form.common").hide();
$(".expand").click(function(){
$(this).closest("form.common").show();
});
$(".collapse").click(function () {
$(this).closest("form.common").hide();
});
});
</script>
<div id="main_Container">
<div class="module">
<h3>Customer Activity Log</h3>
<div class="module_actions">
<span class="icons_small right expand">+</span> <!-- -->
<span class="icons_small right collapse">-</span> <!-- -->
</div>
<form class="common">
<p>Form Stuff</p>
</form>
</div>
<div class="module">
<h3>Customer Activity Log</h3>
<div class="module_actions">
<span class="icons_small right expand">+</span> <!-- -->
<span class="icons_small right collapse">-</span> <!-- -->
</div>
<form class="common">
<p>Form Stuff</p>
</form>
</div>
</div>