【发布时间】:2017-08-26 22:31:41
【问题描述】:
好的,我已经搜索了一段时间,但仍然没有找到任何可以解决我的问题的方法。
在选择单选按钮后,我正在使用 JQuery 更新 ASP.NET 中的只读文本框。该值显示出来,从 HTML 的角度来看,一切似乎都可以正常工作,但后面代码中的 Address.Text 没有返回任何内容。
另外,我已经在 JavaScript 部分发布了我的所有尝试,我知道我应该只需要其中一个来更新我要更新的内容。
HTML:
<asp:TextBox class="form-control form-inline" runat="server" ID="Address" placeholder="Populates based off account type" readonly="true"/>
JavaScript:
$(document).ready(function () {
$('input[type=radio]').click(function () {
$('#Address').attr("value", $(this).val());
$('#Address').attr("Text", $(this).val())
$('#Address').val($(this).val());
$('#<%= Address.ClientID %>').val($(this).val());
$('#<%= Address.ClientID %>').text($(this).val());
$('#AccountType').val($(this).val());
});
});
ASP.NET
ClientScript.RegisterStartupScript(GetType(), "myalert", "alert('Address: " + Address.Text + "' );", true);
提前感谢任何可以帮助我的人。
【问题讨论】:
-
单选按钮代码:
标签: javascript c# jquery html asp.net