I have the below layout for a bunch of inputs on a page and I would like to arrange them based on whether or not a value is present within an input field.
If the "parent" container has a <tr class="Off">
then the entire thing should be moved into the <div class="lowerParent">
and if it contains <tr class="On">
then move it to the <div class="upperParent">
.
The purpose behind this is that I have a page with potentially 50+ inputs, not all of which are going to be used, and I would like to move those which have values toward the top, so the user doesn't have to scroll down a huge page of input fields that are mostly not used.
<div class='upperParent'></div>
<div class='lowerParent'></div>
<div class="parent">
<div class="collapsed">
<table>
<tr>
<td class="headers">
<input type="text" name="ind1" value="0"><input type="text" name="ind2" value="1">
</td>
</tr>
<tr class="On">
<td class="subHeaders">Sub Header 1</td>
<td><input type="text" name="datafieldtag_value[33]" value="1"></td>
</tr>
<tr class="On">
<td class="subHeaders">Sub Header 2</td>
<td><input type="text" name="datafieldtag_value[34]" value="2"></td>
</tr>
<tr class="On">
<td class="subHeaders">Sub Header 3</td>
<td><input type="text" name="datafieldtag_value[35]" value="3"></td>
</tr>
</table>
</div>
</div>
<div class="parent">
<div class="collapsed">
<table>
<tr>
<td class="headers">
<input type="text" name="ind1" value="0"><input type="text" name="ind2" value="1">
</td>
</tr>
<tr class="Off">
<td class="subHeaders">Sub Header 1</td>
<td><input type="text" name="datafieldtag_value[36]" value=""></td>
</tr>
<tr class="Off">
<td class="subHeaders">Sub Header 2</td>
<td><input type="text" name="datafieldtag_value[37]" value=""></td>
</tr>
<tr class="Off">
<td class="subHeaders">Sub Header 3</td>
<td><input type="text" name="datafieldtag_value[38]" value=""></td>
</tr>
</table>
</div>
</div>