【发布时间】:2014-08-26 14:31:18
【问题描述】:
我正在尝试使用 JQuery 设置 asp.net 单选按钮列表项的值(和文本)。我正在尝试选择 RBL 项目的索引并设置它们的值和文本。我尝试了各种变体但没有成功。请提供任何帮助。以下是我的标记。
<body>
<form id="form1" runat="server">
<div>
<asp:RadioButtonList ID="RBL" runat="server" ClientIDMode="Static">
<asp:ListItem></asp:ListItem>
<asp:ListItem></asp:ListItem>
<asp:ListItem></asp:ListItem>
<asp:ListItem></asp:ListItem>
</asp:RadioButtonList>
</div>
</form>
<head runat="server">
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script type="text/javascript">
$(document).ready(
function() {
$($('#RBL').get[1]).val('One');
$($('#RBL').index(2)).val('Two');
$($('#RBL')[3]).val('Value');
});
【问题讨论】: