0
我的例子形式:如何在輸入更改時清除表單?
@using (@Html.BeginForm())
{
@Html.AntiForgeryToken()
<div class="form-group">
@Html.LabelFor(model => model.Server)
@Html.TextBoxFor(model => model.Server, new { @class = "form-control", id = "serverTextbox" })
</div>
<div class="form-group">
@Html.LabelFor(model => model.Username)
@Html.DropDownListFor(model => model.Username, Enumerable.Empty<SelectListItem>(), new { @class = "form-control", id = "usersCombo" })
</div>
<div class="form-group">
@Html.LabelFor(model => model.Password)
@Html.PasswordFor(model => model.Password, new { @class = "form-control" })
</div>
<div class="form-group">
@Html.LabelFor(model => model.Database)
@Html.DropDownListFor(model => model.Database, Enumerable.Empty<SelectListItem>(), new { @class = "form-control", id = "databaseCombo" })
</div>
<div class="form-group">
@Html.LabelFor(model => model.Company)
@Html.DropDownListFor(model => model.Company, Enumerable.Empty<SelectListItem>(), new { @class = "form-control", id = "companyCombo" })
</div>
<div class="form-group">
<input type="submit" id="LogOn" value="Log In" class="btn btn-default" />
</div>
<div>
@Html.ValidationSummary(true)
</div>
}
因此,當用戶更改其服務器項(第一輸入),我期待實現一個.change()事件偵聽器(我認爲),以清除其他從屬形式(下拉&輸入),而不使用實際的重置按鈕。
任何幫助表示讚賞
如何'$( ':輸入')。在( '變',函數(){$( '形式')。 reset()})'? – Rayon