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>
Just put them inside a form then give the radio buttons same names then HTML will do the trick for you.
Or if there are more than one radio that you want to check it is advisable that you use checkboxes and just iterate in javascript (using jquery).
Example:
$('#tableID tr td').find('input[type="checkbox"]').each(function(){
if(this.value == "Index 1"){
this.checked = true;
}
});