你如何获得ASP的检查值:单选按钮使用jQuery? [英] How do you get the checked value of asp:RadioButton with jQuery?
本文介绍了你如何获得ASP的检查值:单选按钮使用jQuery?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要做的是这样的:
<asp:RadioButton ID="rbDate" runat="server" Text="Date" GroupName="grpPrimary" />
和能够检查jQuery的单选按钮的选定值的价值,但我喜欢尝试这些不返回真/假。
and be able to check the value of the radio button's checked value in jQuery, but my attempts like these don't return true/false.
if ($('[name=rbDate]').attr("Checked"))
if ($('[name=rbDate]').attr("Checked").val())
if ($('[name=rbDate]:checked').val())
有一点帮助?
推荐答案
这是可能做到这一点最简单的方法。在 * = 搜索整个id属性的 rbDate 这需要整个ASP.NET识别码ID照顾。
This is probably the easiest way to do it. The *= searches the whole id attribute for rbDate which takes care of the whole ASP.NET id mangling.
$('input[id*=rbDate]').is(":checked");
这篇关于你如何获得ASP的检查值:单选按钮使用jQuery?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文