I have following table with some rows and want to disable the all the controls inside each row.
Below is my HTML code:
<table id="tblChildData">
<tr id="trChild2">
<td>
2
</td>
<td style="height: 30px;">
<%:Html.TextBoxFor(m=>m.childName2) %><%--<br />
<%: Html.ValidationMessageFor(m=>m.SpouseName,null,new{@Class="field-validation-message"}) %>--%>
</td>
<td style="height: 30px; text-align: center;">
M<%: Html.RadioButtonFor(m=>m.genderIdChild2,1) %>
F<%:Html.RadioButtonFor(m=>m.genderIdChild2,2) %>
</td>
<td style="height: 30px; text-align: center;">
<%:Html.TextBoxFor(m=>m.ageChild2,new{Style="width:30px;",maxlength=3}) %><%--<br />
<%:Html.ValidationMessageFor(m=>m.SpouseAge,null,new{@Class="field-validation-message"}) %>--%>
</td>
<td style="height: 30px; text-align: center;">
Married<%: Html.RadioButtonFor(m=>m.maritialStatusChild2,1) %>
UnMarried<%:Html.RadioButtonFor(m=>m.maritialStatusChild2,2) %>
</td>
</tr>
</table>
below is the code for jQuery I have used to disabled the controls inside each table rows:
$("#trChild2").find("input,button,textarea").attr("disabled", true);
$("#trChild2").hide();
$("#trChild3").find("input,button,textarea").attr("disabled", true);
$("#trChild3").hide();
$("#trChild4").find("input,button,textarea").attr("disabled", true);
$("#trChild4").hide();
$("#trChild5").find("input,button,textarea").attr("disabled", true);
$("#trChild5").hide();
$("#trChild6").find("input,button,textarea").attr("disabled", true);
$("#trChild6").hide();
$("#trChild7").find("input,button,textarea").attr("disabled", true);
$("#trChild7").hide();
$("#trChild8").find("input,button,textarea").attr("disabled", true);
$("#trChild8").hide();
$("#trChild9").find("input,button,textarea").attr("disabled", true);
$("#trChild9").hide();
$("#trChild10").find("input,button,textarea").attr("disabled", true);
$("#trChild10").hide();
$("#trChild11").find("input,button,textarea").attr("disabled", true);
$("#trChild11").hide();
$("#trChild12").find("input,button,textarea").attr("disabled", true);
$("#trChild12").hide();
but I dont know why it is only hiding the table rows but not disabling the controls inside the rows...
I have tried this on jsfiddle also but there it seems to be working fine: http://jsfiddle.net/3QuT4/1/
Please help me..
Thanks,
Aman