在我的網頁我有一個錶行通常是這樣的:jQuery的複選框匹配單選按鈕列表
<tr class = "child">
<td>
<asp:CheckBox ID="CheckBoxEyeProblems" runat="server" />
</td>
<td align="center">
<asp:RadioButtonList ID="RadioButtonListEyeProblems"
<asp:ListItem Value="Y">Yes</asp:ListItem>
<asp:ListItem Value="N">No</asp:ListItem>
</asp:RadioButtonList>
</td>
</tr>
我所試圖做的是禁用/啓用同一行中單選按鈕列表的複選框你的時候選中/取消選中它。
$('tr.child input:checkbox').click(function()
{
//last part of this selector is incorrect, how to correct it here?
var rblist = $(this).closest('tr.child').find(':input:radio');
if ($(this).is(':checked'))
{
//aslo not sure how to clear selection if any from RadioButtonList here
rblist.attr('disabled', 'disabled');
}
else
{
rblist.removeAttr('disabled');
}
});
所以,這些都是我的問題。我正在使用ASP.NET 3.5。
不,你不使用ASP,你使用jQuery與ASP生成的標記。向我們展示標記(HTML),而不是您的ASP代碼。 – bdl 2010-02-24 04:37:38
這個頁面是主頁面下的內容頁面,所以HTML會有很多的id損壞。這可能會讓我更好地瞭解我正在嘗試做什麼。 – Victor 2010-02-24 05:00:10