C# 如何使用jquery获取所选的asp单选按钮?
这是我的aspx代码,默认情况下我选择了第一个。我将如何在Jquery中获取值C# 如何使用jquery获取所选的asp单选按钮?,c#,jquery,radiobuttonlist,C#,Jquery,Radiobuttonlist,这是我的aspx代码,默认情况下我选择了第一个。我将如何在Jquery中获取值 <asp:RadioButtonList runat="server" ID="rbDisType" RepeatDirection="Horizontal" CssClass="styleRadioButton"> <asp:ListItem Text="Sale" Value="True" Selected="True"></asp:ListItem> <asp:List
<asp:RadioButtonList runat="server" ID="rbDisType" RepeatDirection="Horizontal" CssClass="styleRadioButton">
<asp:ListItem Text="Sale" Value="True" Selected="True"></asp:ListItem>
<asp:ListItem Text="Damage" Value="False"></asp:ListItem>
</asp:RadioButtonList>
这是代码的重入者
<table id="ctl00_ContentPlaceHolder1_rbDisType" class="styleRadioButton ui-buttonset" border="0">
<tbody><tr>
<td><input class="ui-helper-hidden-accessible" id="ctl00_ContentPlaceHolder1_rbDisType_0" name="ctl00$ContentPlaceHolder1$rbDisType" value="True" checked="checked" type="radio"><label aria-disabled="false" role="button" aria-pressed="false" class="ui-button ui-widget ui-state-default ui-button-text-only ui-corner-left" for="ctl00_ContentPlaceHolder1_rbDisType_0"><span class="ui-button-text">Sale</span></label></td>
<td><input class="ui-helper-hidden-accessible" id="ctl00_ContentPlaceHolder1_rbDisType_1" name="ctl00$ContentPlaceHolder1$rbDisType" value="False" type="radio"><label aria-disabled="false" role="button" class="ui-button ui-widget ui-state-default ui-button-text-only ui-corner-right ui-state-active" aria-pressed="true" for="ctl00_ContentPlaceHolder1_rbDisType_1"><span class="ui-button-text">Damage</span></label></td>
</tr>
</tbody></table>
特价
损坏
首先查看生成的代码,即查看浏览器接收到的源代码。然后通过ID,您可以使用JQuery轻松地导航到那里并读取值,应该是这样的
$("#rbDisType").val()
首先查看生成的代码,即查看浏览器接收到的源代码。然后通过ID,您可以使用JQuery轻松地导航到那里并读取值,应该是这样的
$("#rbDisType").val()
试试这个:
$("input:radio[name$='rbDisType']").click(function(){
alert($(this).val());
});
试试这个:
$("input:radio[name$='rbDisType']").click(function(){
alert($(this).val());
});
我在它重新进入时添加了代码。我在它重新进入时添加了代码。