我有一个Razor 语法的注册表单,如下所示
<div id="RegisterDiv" class="is-hidden">
@using (Html.BeginForm("Register", "User", FormMethod.Post, new { id = "frmRegister" }))
{
<label>Email</label>
@Html.TextBoxFor(lm => lm.Email, new { id = "Email", name = "Email", value = "", placeholder = "Enter your email" })
<small id="Emailerror" class="error is-hidden">A valid email address is required</small>
<label>Password</label>
@Html.PasswordFor(lm => lm.Password, new { id = "Password", name = "Password", value = "", maxlength = "20" })
<small id="Passworderror" class="error is-hidden"></small>
@Html.PasswordFor(lm => lm.VerifyPassword, new { id = "VerifyPassword", name = "VerifyPassword", value = "", maxlength = "20" })
<small id="VerifyPassworderror" class="error is-hidden"></small>
<small class="help-block">* must be 6-20 characters (letters, numbers and hyphens are accepted but not spaces)</small>
<hr>
<div class="form-row">
<div class="six columns">
@Html.TextBoxFor(lm => lm.FirstName, new { id = "FirstName", name = "FirstName", value = "", placeholder = "First Name" })
<small id="FirstNameerror" class="error is-hidden">First name is required</small>
</div>
<div class="six columns">
@Html.TextBoxFor(lm => lm.LastName, new { id = "LastName", name = "LastName", value = "", placeholder = "Last Name" })
<small id="LastNameerror" class="error is-hidden">Last name is required</small>
</div>
</div>
<div class="form-row">
<div class="six columns">
@Html.DropDownListFor(dr => dr.CountryId, new SelectList(Model.CountryList, "countryid", "name"), "Country of Residence", new { id = "CountryId", name = "CountryId" })
<small id="CountryIderror" class="error is-hidden">Country is required</small>
</div>
</div>
<div class="form-action">
<a id="Submit" class="form-submit" href="javaScript:void(0);">Register</a>
<a id="Cancel" class="form-cancel" href="javaScript:void(0);">Cancel</a>
</div>
}
</div>
提交代码是
$("#frmRegister").submit();
但是当应用程序在 IE-8 上运行时,元素 id=" Password " 和 id=" VerifyPassword " 的值不会被发送到服务器。在删除占位符属性时它工作正常,即数据被发送到服务器。在不删除占位符属性的情况下是否有任何解决此问题的方法?如果没有,除了 like 之外还有其他保留占位符的方法placeholder = "Verify Password"
吗?