Jquery 验证不起作用
我正在尝试在使用两个日期选择器“ effectiveDate”和“ termDate”的表单上使用 Jquery 验证。生效日期不得早于期限日期。日期选择器可以工作,但当我违反验证时,不会显示任何错误。
<script language="javascript" type="text/javascript">
jQuery(document).ready(function () {
$("form").validate();
var term = $("#TermDate").val();
$("#EffectiveDate").datepicker({
minDate: term
});
});
</script>
I'm trying to use Jquery validations on a form that uses two datepicker "effectiveDate" and "termDate". EffectiveDate must not be prior to TermDate. The datepicker works but there are not any errors being display when I violate the validation.
<script language="javascript" type="text/javascript">
jQuery(document).ready(function () {
$("form").validate();
var term = $("#TermDate").val();
$("#EffectiveDate").datepicker({
minDate: term
});
});
</script>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要应用验证规则 (
dpDate
),如本文:要使此规则生效,您必须将
jquery.ui.datepicker.validation.js
扩展添加到您的页面。You need to apply a validation rule (
dpDate
) as explained in this article:For this rule to take effect you must add the
jquery.ui.datepicker.validation.js
extension to your page.