I have callout label associated with multiple controls, which should turn red when either of it is wrong.
<tr>
<th>
<asp:Label for="test">jquery will make my class as updnValidationErrorLabel</asp:Label>
</th>
<td > this text is right
<asp:TextBox class='textboxWide taskListCheckPreVital' />
</td>
<td>this is wrong text hence it has updnValidationErrorInput
<asp:TextBox class='dummyclass updnValidationErrorInput'/></td>
</tr>
I'm trying this approach, but not sure why mainparent children element does not show with class updnValidationErrorInput
//if my sturcture has updnValidationErrorInput
$('.updnValidationErrorInput').each(function() {
// go to tr element
var mainParent = $(this).parents('tr:first');
// under tr element find updnValidationErrorInput
if(mainParent.children('.updnValidationErrorInput').length > 0){
// set label which has for attribute with updnValidationErrorLabel
mainParent.children('label').attr('for').removeClass().addClass('updnValidationErrorLabel');
}
});
Any help will be greatly appreciated.