複数のコントロールに関連付けられたコールアウトラベルがあり、どちらかが間違っていると赤に変わるはずです。
<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>
私はこのアプローチを試していますが、主な親の子要素がクラスで表示されない理由がわかりません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');
}
});
どんな助けでも大歓迎です。