I have the following HTML code:
<tr>
<td>
<span>Random question here?</span>
</td>
<td>
<asp:RadioButtonList ID="someList" runat="server" SelectedValue="<%# Bind('someValue') %>" 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>
</td>
<td>
<asp:TextBox ID="txtSomeValue" runat="server" Height="16px" CssClass="someScore" Enabled="false" Text="0"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:TextBox ID="txtSomeTotal" runat="server" Height="16px" CssClass="someTotal" Enabled="false" Text="0"></asp:TextBox>
<asp:Label ID="lblTFTotal" runat="server" Font-Bold="true" Font-Italic="true" Text="Your selected value is"></asp:Label>
</td>
</tr>
I need to write a jQuery function that populates the 'txtSomeValue' TextBox with the value selected from the RadioButtonList, and then calculates all the values selected (from about 10 of these RadioButtonLists) into the 'txtSomeTotal' TextBox.
I'm quite new to jQuery. Any help would be awesome.
Thanks
Ivan almost got it - but there's a quicker way. Use JQuery to select the RBL, then filter by the selected input:
$("#<%# rbRadioButtonListId.ClientID %> input:radio:checked").val();
No need for trapping tables or the Name of the radio buttons.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With