Reputation: 692
I have the following setup currently:
<tr class="NoBackgroundTR">
<asp:HiddenField runat="server" Value='<%# Eval("Adresse").ToString() %>' ></asp:HiddenField></td>
</tr>
This would be pretty much be the code I would want to write:
function setBGColor()
{
var table = document.getElementById("AlleAnzeigenTable");
for (var i = 0, row; row = table.rows[i]; i++) {
// here I would like to get the HiddenField inside of my TableRow
if(row.HiddenField.value != 'someValue')
row.style.backgroundColor = '#F79A03';
}
}
How would I access the Hiddenfield inside of my TableRow?
Upvotes: 0
Views: 271
Reputation: 14614
If you have hidden field as very first control you can use below code.
But i would recommend to use an ID
or ClassName
in order to access
the HiddenFeild
inside row
.
var table = document.getElementById("AlleAnzeigenTable");
for (var i = 0, row; row = table.rows[i]; i++) {
var value = row.getElementsByTagName("input")[0].value;
}
Upvotes: 0
Reputation: 4919
With jQuery, you can access it like this:
var myHiddenField = $(row).find('input[type="hidden"]');
var value = myHiddenField.val();
Upvotes: 1