The jquery code below will hide divs ending with -value-wrapper when the page loads. My issue is, that the "Add more values" button will append another row (with the number incremented). When it does, all the divs are revealed. Is there a way to keep the original ones hidden and hide those in the new set as well?
The html markup looks like this:
<div id="group-information-items">
<fieldset>
<legend>Member Information</legend>
<label>Form label 1</label>
<table>
<tr>
<td>
<div class="form-radios">
<input type="radio" class="form-radio" checked="checked" value="0" name="gci[0][fa][value]" id="edit-gci-value-0"> A
<input type="radio" class="form-radio" value="1" name="gci[0][fa][value]" id="edit-gci-value-0">B
</div>
<!-- This is the div that is hidden -->
<div id="edit-gci-0-fa-list-value-wrapper" class="form-item">
<label>List: </label>
<textarea name="gci[0][fa_list][value]" rows="5" cols="60"></textarea>
</div>
</td>
</tr>
</table>
<!-- WHEN THIS BUTTON IS CLICKED, A CLONE OF THE ROW ABOVE IS APPENDED TO THE TABLE -->
<!-- THE ONLY DIFFERENCE IS [0] BECOMES [1] AND SO ON -->
<div class="content-add-more clear-block">
<input type="submit" value="Add more values" id="edit-gci-add-more" name="gci_add_more">
</div>
</fieldset>
</div>
The code that does the initial hide is below:
$("#group-information-items div").each(function() {
$("div[id$='-value-wrapper']").each(function() {
$(this).hide();
});
});