繁体   English   中英

使用JQuery在单击RadioButtonList时隐藏面板

[英]Hiding a panel on click of RadioButtonList using JQuery

我有一个asp:RadioButtonList和一个面板

<asp:RadioButtonList ID="someList" runat="server"    
RepeatDirection="Horizontal" CssClass="radioList">
    <asp:ListItem Text="Yes" Value="1"></asp:ListItem>
    <asp:ListItem Text="No" Value="4"></asp:ListItem>
    <asp:ListItem Text="Don't Know" Value="2"></asp:ListItem>                                        
</asp:RadioButtonList>
<asp:Panel ID="Panel1" runat="server" Style="display: none;">
This is panel 1
</asp:Panel>

当我单击“是”时,当我单击“否”和“不知道”时,应该显示该面板。 帮助将不胜感激谢谢

尝试这个:

var panel = $("#Panel1"); 
$("input[name='cboVisibility']").change(function () { 
  if ($(this).val() == 1) panel.show(); 
  else panel.hide() 
})

http://jsfiddle.net/KevQv/

  var panel = $("#<%= this.Panel1.ClientID %>")  
  $(".radioList").change(function(){
           if($(this).val() == 1)
              panel.show();
           else
              panel.hide()

    })

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM