2012-07-03 113 views
2

我有一个ASP的单选按钮列表中点击面板:单选按钮列表和一个面板隐藏使用JQuery

<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> 

当我点击,当我点击“否”和“不知道是面板应显示“面板应该隐藏起来。 帮助,将不胜感激 感谢

+0

我使用的单选按钮也如此,但不是单选按钮列表! –

回答

0

试试这个:

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

http://jsfiddle.net/KevQv/

+0

它相当'<%= this.Panel1.ClientID%>':) –

+0

@undefined。:它不起作用。 –

+0

@palakmehta plz发布输出的标记不是asp代码。 – undefined

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

    }) 
+0

:它不工作 –

+0

现在它应该工作 – Yorgo