I'm looking to write a piece of a larger program which I would like to search the source html on a website for one of two values "Index 1" or "Index 2" within a unknown number of tags, then edit the tag above the containing "Index 1" or Index 2" (still within the same table row ) to denote a checkbox is checked or unchecked. As an example: I want to achieve all "Index 1" checkboxes on while "Index 2" checkboxes are off. I'm not entirely sure the best way to approach this and am looking for guidance in the right direction. Here is some mock code which may help
<fieldset class="stackedSection">
<legend >someThings</legend> <table>
<tr>
<td><input name="someId[]" type="checkbox" value="001"></input></td>
<td><a href="associated?id=001">nameOfAssociatedID001</a> index 1 (<a href="device?id=a01">name1</a>)</td>
</tr>
<tr>
<td><input name="someId[]" type="checkbox" value="002" checked></input></td>
<td><a href="associated?id=002">nameOfAssociatedID002</a> index 1 (<a href="device?id=a02">name2</a>)</td>
</tr>
<tr>
<td><input name="someId[]" type="checkbox" value="003" checked></input></td>
<td><a href="associated?id=003">nameOfAssociatedID003</a> index 1 (<a href="device?id=a03">name3</a>)</td>
</tr>
<tr>
<td><input name="someId[]" type="checkbox" value="004" checked></input></td>
<td><a href="some?id=004">nameOfAssociatedID004</a> index 2 (<a href="device?id=a04">name4</a>)</td>
</tr>
</table>
</fieldset>