-6ren">
gpt4 book ai didi

获取 RadioButtonList 值的 jQuery 函数

转载 作者:行者123 更新时间:2023-12-03 22:58:01 26 4
gpt4 key购买 nike

我有以下 HTML 代码:

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

我需要编写一个 jQuery 函数,用从 RadioButtonList 中选择的值填充“txtSomeValue”文本框,然后将所有选定的值(来自大约 10 个 RadioButtonList)计算到“txtSomeTotal”文本框中。

我对 jQuery 还很陌生。任何帮助都会很棒。

谢谢

最佳答案

伊万几乎明白了 - 但有一个更快的方法。使用 JQuery 选择 RBL,然后按所选输入进行过滤:

$("#<%# rbRadioButtonListId.ClientID %> input:radio:checked").val();

无需捕获表格或单选按钮的名称。

关于获取 RadioButtonList 值的 jQuery 函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7915908/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com