ドロップダウンリストで選択したテキストオプションをMVCビューのテキスト領域Jqueryにコピーしようとしていますが、 tのテキストを表示..任意のヘルプ?ドロップダウンリストをmvcビューのテキスト領域にコピーする - JQuery/Javascript
<div class="form-group">
@Html.Label("LocationText", "Location Letter Text ", htmlAttributes: new { @class = "control-label col-md-2" })
<br />
@Html.DropDownList("RemarksId", null, new { id = "RemarksId", @class = "form-control" })
<div class="col-md-10">
</div>
</div>
<div class="form-group">
<div class="col-md-10">
@Html.LabelFor(model => model.Remarks, htmlAttributes: new { @class = "control-label col-md-2" })
</div>
@Html.TextAreaFor(model => model.Remarks, new { @class = "form-control", id = "Remarks", rows = 5, cols = 70 })
@Html.ValidationMessageFor(model => model.Remarks, "", new { @class = "text-danger" })
</div>
jQueryの
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
<script src="~/Scripts/jquery-1.10.2.min.js"></script>
<script type="text/jscript">
$(function() {
$('#RemarksId').change(function() {
var str= $("#RemarksId option:selected").text();
$('#Remarks').val(str);
});
});
</script>
}
あなたのバンドルにはどのようなスクリプトがありますか? jqueryタグをバンドルの上に移動する必要があります(バンドルに含まれている場合は完全に削除してください) – Pete
スクリプトのURLが間違っている可能性があります。あなたのコードは$(function()...)に変更機能を書く必要がないように見えるので、 –
私は何のURLを使うことができますか?/ – Marimar