My approximate HTML:
<div id='ComputerID'></div>
<table id='gridComputerApps'>
<tr>
<td><div class='licenseOutput'/></td> <td><div class='AppName'>IE6</div></td>
<td><div class='licenseOutput'/></td> <td><div class='AppName'>Firefox</div></td>
<td><div class='licenseOutput'/></td> <td><div class='AppName'>SuperApp #2</div></td>
</tr>
</table>
(Note, there are possibly other columns mixed in here, so I want to be selecting on class name).
So, using jQuery, I have to act on each row in this table.
For each row, I have to pass: ('#ComputerID').val(), ('.AppName').val() and ('.licenseOuput') into a javascript function, which then using the values for ComputerID and AppName, sets the text and color of the licenseOutput div.
So, I am thinking something starting with the following might work:
$('#gridComputerApps').children('tr').each(function() {
//so, do I now have access to all the ,tr> elements within #gridComputerapps?
//now, how do i select the subordinate elements, for each row???
});
SOLUTION
Here's what finally worked for me:
$('#gridComputerApps tr').each(function() {
var networkUserID = $("#PrimaryUserNetworkID").text();
var appName = $(this).find(".AppName").text();
var licenseOutputCell = $(this).find(".licenseOutput");
if (appName != '') CheckAppSecForUser(licenseOutputCell, appName, networkUserID);
});
Important note to asp.net users:
From what I can tell, setting ControlStyle-CssClass="AppName" on an asp BoundField is useless, and the classname is never output to the html.
Instead, I had to make a template field, and wrap the boundfield in a div, like so:
<asp:TemplateField HeaderText="Application Name" Visible="True" HeaderStyle-Width="15%" ItemStyle-VerticalAlign="Top">
<ItemTemplate><div class="xxxAppName"><%#Eval("Application.NormalizedAppName")%></div></ItemTemplate>
</asp:TemplateField>