Javascript MVC从Textboxfor值填充Textboxfor On按钮单击
我对这有点陌生。如何使用按钮单击上的Javascript MVC从Textboxfor值填充Textboxfor On按钮单击,javascript,asp.net-mvc,Javascript,Asp.net Mvc,我对这有点陌生。如何使用按钮单击上的TextBoxFor中的值填充TextBoxFor? 我正在创建一个确认模式,其中用户在TextBoxFor中输入数据,当单击submit按钮时,将弹出一个确认对话框,其中包含提交的凭据。问题是在的模态文本框中没有显示值 父文本框 <div class="col-md-10"> @Html.TextBoxFor(model => model.name, new { htmlAttributes = new { @class =
TextBoxFor
中的值填充TextBoxFor
?
我正在创建一个确认模式,其中用户在TextBoxFor中输入数据,当单击submit按钮时,将弹出一个确认对话框,其中包含提交的凭据。问题是在的模态文本框中没有显示值
父文本框
<div class="col-md-10">
@Html.TextBoxFor(model => model.name, new { htmlAttributes = new { @class = "form-control", @id = "name" } })
@Html.ValidationMessageFor(model => model.name, "", new { @class = "text-danger" })
</div>
<button type="button" id="submitBtn" class="btn btn-primary" data-toggle="modal" data-target="#login-modal" data-backdrop="static" data-keyboard="false">Submit</button>
<div id="login-modal" tabindex="-1" role="dialog" aria-hidden="true" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
Confirm Submit
<button type="button" data-dismiss="modal" aria-hidden="true" class="close">×</button>
</div>
<div class="modal-body">
Are you sure you want to submit the following details?
<br/>
<br/>
<table class="table">
<tr>
<th>Queue Number</th>
<td>@Html.TextBoxFor(model => model.name, new {htmlAttributes = new {@class = "form-control", @id = "namee"}})</td>
</tr>
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<a href="#" id="submit" class="btn btn-success success">Submit</a>
</div>
}
</div>
</div>
我还尝试用
更改父TextBoxFor,但仍然什么也没做
提前感谢。
$('namee').val($('name').val())代码>(不是text()
)@StephenMuecke试图更改它,但仍然没有任何结果。
$('#submitBtn').click(function () {
$('#namee').text($('#name').val());
var x = document.getElementById("name").value;
document.getElementById("namee").innerHTML = x;
});