我的代码/浏览器存在严重问题。我试图实施 SO 提供的解决方案,但没有一个对我有用。这是我看过的一些:
- jQuery 的 $(form).submit() 仅针对 IE 不触发(MVC3 应用程序)
- jQuery:表单不使用 $("#id").submit() 提交,但会使用“提交”按钮提交?
- 表单提交 jQuery 不起作用
我的问题是:我有一个在 IE11 上不起作用的提交按钮,但是当我使用 IE 开发人员工具降级 IE8 版本时,它可以正常工作。有什么线索吗?自从我试图让它在 IE 11 上工作 3 天以来,我已经拔掉了一半的头发。欢迎任何想法。
这是jquery代码:
if (isOtherValid == true) {
formsubmit = true;
$('#StupidForm').submit();
document.StupidForm.submit()
alert('Test');
form.submit();
return true;
}
}
else {
alert('You must select at least 1 CE type');
}
这是我的剃刀观点:
@model TCEO.MVC.Person.MyModel
@{
ViewBag.Title = "Course Sign Up";
}
@section Styles {
<link href="@Url.Content("~/Content/enroll_learner_validation.css")" rel="stylesheet" type="text/css" />
}
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.0/themes/base/jquery-ui.css" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>
<script type="text/javascript" src="http://code.jquery.com/ui/1.10.0/jquery-ui.js"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<h2>@Model.courseEnrollment.CourseTitle</h2>
<div style="padding-left:25px;">
@{
var namePrint = Model.FirstName;
if (!(Model.MiddleInitial == null) && Model.MiddleInitial.Length == 1)
{ namePrint = namePrint + " " + Model.MiddleInitial + ". "; }
else
{ namePrint = namePrint + " "; }
namePrint = namePrint + Model.LastName;
<span style=" font-size:18px; color:navy;">@namePrint</span>
<br /><br />
}
<h3>Update Your Account</h3>
<span style=" font-size:18px; color:navy;">Verify your information below...</span>
@{ Html.EnableClientValidation(); }
@using (Html.BeginForm("EnrollLearnerValidationCompleteForm", "Course", FormMethod.Post, new { id = "StupidForm" }))
{
@Html.ValidationSummary(true)
<fieldset>
<legend></legend>
@Html.HiddenFor(model => model.LearnerID)
@Html.HiddenFor(model => model.FirstName)
@Html.HiddenFor(model => model.MiddleInitial)
@Html.HiddenFor(model => model.LastName)
@Html.HiddenFor(model => model.AddressLine1)
@Html.HiddenFor(model => model.AddressLine2)
@Html.HiddenFor(model => model.AddressLine3)
@Html.HiddenFor(model => model.City)
@Html.HiddenFor(model => model.CountrySelectedItem)
@Html.HiddenFor(model => model.StateSelectedItem)
@Html.HiddenFor(model => model.ZipCode)
@Html.HiddenFor(model => model.courseEnrollment.AdjustRecord)
@Html.HiddenFor(model => model.Email)
</fieldset>
}