我有以下 ASP.NET RadioButtonList:
<asp:RadioButtonList ID="rbl" runat="server">
<asp:ListItem Text="Type1" Value="1" />
<asp:ListItem Text="Type2" Value="2" />
</asp:RadioButtonList>
我想通过这样的客户端jquery函数以编程方式选择列表中的一个项目(简化版):
function BindWidget(widget) {
// Type property of Widget is an int.
$("#<%=rbl.ClientID%>").selectItemByValue(widget.Type);
}
理想情况下,有一些函数 - 在上面的代码中我提出了 selectItemByValue - 通过给定值选择 RadioButtonList 中的项目。jquery 是否内置了类似的功能?如果没有,我应该如何实现所需的功能?