0
我目前有一个asp.net Mvc5应用程序,它具有许多字段(星期几)作为时间跨度。这样用户就可以记录他们花在案件上的时间。从阅读Range and DisplayFormat Attributes on TimeSpan我发现我需要包括以下jQuery规则删除验证
<script>
$(document).ready(function() {
$("#ScheduleTime").rules('remove', 'range');
});
这是罚款和工作在我的第一个字段。我改变了代码来整合所有这些领域。
<script>
$(document).ready(function() {
$("#Monday, #Tuesday, #Wednesday, #Thursday, #Friday, #Saturday, #Sunday").rules('remove', 'range');
});
我已经是它是通过剃刀语法
<div class="form-group">
@Html.LabelFor(model => model.Monday, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Monday, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Monday, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.Tuesday, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Tuesday, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Tuesday, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.Wednesday, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Wednesday, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Wednesday, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.Thursday, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Thursday, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Thursday, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.Friday, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Friday, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Friday, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.Saturday, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Saturday, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Saturday, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.Sunday, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Sunday, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Sunday, "", new { @class = "text-danger" })
</div>
</div>
做然而,这不工作的最新观点。我如何解决这个问题?
非常感谢
什么是'.rules()'jQuery插件?它支持选择多个元素吗? – epascarello
显示DOM请(标记示例) – thinice
这是jquery'rules()'插件http://jqueryvalidation.org/rules/ – markabarmi