0
值我有一個像這樣更新文本區與複選框
@Html.Partial("_validationSummary")
<div class="row-fluid">
<div class ="span8 well">
@using (Html.BeginForm("Send", "Message", FormMethod.Post)) {
<fieldset>
<legend>Send SMS Message</legend>
<div class="editor-label text-info">
<small>Recipients phone numbers here.</small>
</div>
<div class="editor-field">
@Html.TextAreaFor(model => model.MessageRecipients, new { @class = "span8", rows=3 })
</div>
<div class="editor-label text-info">
<small>Select from your contact listings =>.</small>
</div>
<div class="editor-field">
@Html.TextAreaFor(model => model.ContactRecipients, new { @class = "span8", rows=3, @readonly=true })
</div>
<div class="editor-label text-info">
<small> Your Message Here:</small>
</div>
<div class="editor-field">
@Html.TextAreaFor(model => model.Message, new { @class = "span8", rows = 5})
<br />
<span class="text-warning" id="char_count"></span><br />
</div>
<div class="editor-label text-info"><small>
Send Message As:</small>
</div>
<div class="editor-field">
@Html.TextBoxFor(model => model.MessageSentAS)
</div>
<br />
<p> <input type="submit" class="btn btn-primary btn-medium" Value="Send" name="Action" />
<button role="button" class="btn btn-medium" data-target="#timeModal" data-toggle="modal">Send Later</button>
</p>
</fieldset>
}
</div>
<div id="ContactList" class="span4 well" >
<span class="label label-important">Select From Contact List</span>
<hr />
@* @Html.Partial("_ContactsForMessageViewPartial", Model)*@
@Html.Action("RenderContacts");
<hr />
<div class="control-group">
[@Html.ActionLink("Send Bulk SMS", "Send", "BulkMessaging")] [@Html.ActionLink("Add Contact", "AddContact", "Contact")]
</div>
</div>
美景,並從兒童行動填充數據的局部視圖
@model IEnumerable<TwiiterSample.Models.ViewModels.SMSContactView>
@if (Model != null && Model.Count() > 0)
{
foreach(var item in Model){
<div class="checkbox multiple">
@Html.CheckBox(item.ContactDetails, new {@class="check", @[email protected], [email protected]})
@Html.Label(item.Name)
@*<input type="checkbox" id="@item.Value" value="@item.Value" @(item.Selected ? "checked" : "") />@item.Text</label>*@
</div>
}
}
現在的局部視圖生成根據需要填入IDS和VALUES複選框列表。但是,如果點擊文本區域,我想追加複選框的值。我使用以下JQUERY片段來實現這一點
$('#ContactList .check').change(function()
{
if ($(this).is(':checked'))
$('#MessageRecipients').val($(this).val);
});
但是,只要我點擊一個複選框,沒有任何反應。我在做什麼錯
試過它已經,沒有工作 – 2013-03-24 19:27:59