这是隐藏 ID 为 .style2 的表格单元格的 jquery 代码:
$('#myRadioButtonList').change(function() {
if ($(this).attr('checked') == true && $(this).val() == "HB") {
$('.style2').hide("slow");
};
});
这是我的单选按钮列表
<asp:RadioButtonList ID="myRadioButtonList" runat="server">
<asp:ListItem Selected="True" Value="HB">None</asp:ListItem>
<asp:ListItem Value="HOBSKS">Service </asp:ListItem>
<asp:ListItem Value="OBAKS">Open Service</asp:ListItem>
<asp:ListItem Value="BBKS">Close Service</asp:ListItem>
</asp:RadioButtonList>
我受到这个话题的启发
使用带有 RadioButtons 的 JQuery 来隐藏/显示表格行
这样我的jquery不起作用,部分有错误
if ($(this).attr('checked') == true && $(this).val() == "HB")
我单独尝试了上面的这两个条件,它们都不起作用。我需要使用我的单选按钮,但似乎我做不到。那么我应该如何编写该部分以使我的代码正常工作。
谢谢。