Asp.net mvc 3 如何在asp.net mvc应用程序中使用Jquery重置Div元素中的所有字段值
我有以下看法:-Asp.net mvc 3 如何在asp.net mvc应用程序中使用Jquery重置Div元素中的所有字段值,asp.net-mvc-3,jquery,Asp.net Mvc 3,Jquery,我有以下看法:- <div id = "partialWrapper"> @using (Ajax.BeginForm("Create", "Answer", new AjaxOptions { HttpMethod = "Post", InsertionMode = InsertionMode.InsertAfter, UpdateTargetId = "incrementanswer", OnSuccess = "removePartial" }
<div id = "partialWrapper">
@using (Ajax.BeginForm("Create", "Answer", new AjaxOptions
{
HttpMethod = "Post",
InsertionMode = InsertionMode.InsertAfter,
UpdateTargetId = "incrementanswer",
OnSuccess = "removePartial"
}))
{
<div id = "returnedquestion">
@Html.ValidationSummary(true)
<fieldset>
<legend>Answer here</legend>
<div class="editor-label">
@Html.LabelFor(model => model.Description)
</div>
<div class="editor-field">
@Html.EditorFor(model => model.Description)
@Html.ValidationMessageFor(model => model.Description)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.IsRight)
</div>
<div class="editor-field">
@Html.DropDownList("IsRight", String.Empty)
@Html.ValidationMessageFor(model => model.IsRight)
</div>
</fieldset>
<input type= "hidden" name = "questionid" value = @ViewBag.questionid>
<input type= "hidden" name = "assessmentid" value = @ViewBag.assessmentid>
<input type="submit" value="Add answer" />
</div>
}
</div>
及
那么有没有一种方法可以在不删除字段的情况下清除Div中所有字段中的文本。
BR尝试重置表单:
$('#partialWrapper form')[0].reset();
尝试重置表单:
$('#partialWrapper form')[0].reset();
+1这是理想的方法,因为它不会重置
隐藏字段,这似乎是OP的意图。+1这是理想的方法,因为它不会重置隐藏字段,这似乎是OP的意图。
$('#partialWrapper form')[0].reset();