使用jQuery在回发期间更改单选按钮所选项目文本
我在使用jQuery在回发期间更改单选按钮所选项目文本,jquery,asp.net,asp.net-ajax,updatepanel,Jquery,Asp.net,Asp.net Ajax,Updatepanel,我在更新面板中有一个单选按钮列表,如下所示: <asp:RadioButtonList ID="RadioButtonList1" runat="server" Width="233px" ClientIDMode="Static" AutoPostBack="true" onselectedindexchanged="RadioButtonList1_SelectedIndexChanged">
更新面板中有一个单选按钮列表,如下所示:
<asp:RadioButtonList ID="RadioButtonList1" runat="server" Width="233px"
ClientIDMode="Static" AutoPostBack="true"
onselectedindexchanged="RadioButtonList1_SelectedIndexChanged">
<asp:ListItem Value="1">1</asp:ListItem>
<asp:ListItem Value="2">2</asp:ListItem>
<asp:ListItem Value="3">3</asp:ListItem>
<asp:ListItem Value="4">4</asp:ListItem>
</asp:RadioButtonList>
但它不起作用。我的错在哪里
谢谢省去函数调用,只需在javascript代码块中包含以下内容:
$(document).ready(function () {
$('#RadioButtonList1').on("change", function () {
$("#RadioButtonList1 input:checked").val("Please Wait...");
});
})) 您应该更改此代码:
$("#RadioButtonList1 input:checked").val("Please Wait...");
to
$("#RadioButtonList1 input:checked").parent().find('label').text("Please Wait");
尝试:
函数pageLoad(){
$(文档).ready(函数(){
$('#')。关于(“更改”,函数(){
$(“#”).find(“输入[检查]”).val(“请稍候…”);
});
});
}
单选
按钮值不显示在浏览器视口中,您应该使用标签
并更改其文本:
$(document).ready(function () {
$('#RadioButtonList1').on("change", function () {
$("#RadioButtonList1 input:checked").closest("label").text("Please Wait...");
});
});
请记住检查readiobuttonList的ID是否正确,因为当服务器控件呈现时,ID会发生变化。
function pageLoad() {
$(document).ready(function () {
$('#<%=RadioButtonList1.ClientID %>').on("change", function () {
$("#<%=RadioButtonList1.ClientID %>").find("input[checked]").val("Please Wait...");
});
});
}
$(document).ready(function () {
$('#RadioButtonList1').on("change", function () {
$("#RadioButtonList1 input:checked").closest("label").text("Please Wait...");
});
});