Hiding And Showing multiple areas based on radiobuttonlist input selected

St.Kolya

New Member
I had a similar question to this before but I had to modify it because the user changed their mind. I am working on a script that if option 0 is selected it should show "remind" otherwise keep it hidden. If option 2 is selected it should unhide "cc" otherwise keep it hidden. My problem is that once the event is fired regardless of option 0 or 2 both areas open up. I was just wondering if i could get some help having them work separate. Here is the JS:\[code\] $('#rbPType').change(function () { var op1 = $(this).attr('value', '0'); var op2 = $(this).attr('value', '2'); if (op1) { $('#remind').fadeIn(); } else { $('#remind').fadeOut(); } $(this).change(function () { $('#remind').toggle(); }); if (op2) { $('#cc').fadeIn(); } else { $('#cc').fadeOut(); } $(this).change(function () { $('#cc').toggle(); }); });\[/code\]HTML\[code\]<div class="another"><label for="rbPType">Select One</label><asp:RadioButtonList runat="server" ID="rbPType" ClientIDMode="Static"> <asp:ListItem Value="http://stackoverflow.com/questions/15621768/0" Text="1"></asp:ListItem> <asp:ListItem Value="http://stackoverflow.com/questions/15621768/1" Text="2"></asp:ListItem> <asp:ListItem Value="http://stackoverflow.com/questions/15621768/2" Text="3"></asp:ListItem></asp:RadioButtonList></div><div id="remind"><label for="ddlReminderMonth">Remind Me</label><asp:DropDownList runat="server" ID="ddlReminderMonth" AppendDataBoundItems="true" AutoPostBack="false" /></div><div id="cc"><label for="ddlReminderMonth">Remind Me Two</label><asp:DropDownList runat="server" ID="ddlReminderMonth" AppendDataBoundItems="true" AutoPostBack="false" /></div>\[/code\]
 
Back
Top