日期和时间选择器与验证

时间:2017-04-21 07:28:13

标签: javascript jquery jquerydatetimepicker

我得到了一个更好的例子,用日期选择器验证句点,没有时间。 是否可以一起进行日期和时间验证?

以下示例: http://www.jquerybyexample.net/2012/01/end-date-should-not-be-greater-than.html



$(document).ready(function() {
  $("#txtFromDate").datepicker({
    minDate: 0,
    maxDate: "+60D",
    numberOfMonths: 2,
    onSelect: function(selected) {
      $("#txtToDate").datepicker("option", "minDate", selected)
    }
  });
  $("#txtToDate").datepicker({
    minDate: 0,
    maxDate: "+60D",
    numberOfMonths: 2,
    onSelect: function(selected) {
      $("#txtFromDate").datepicker("option", "maxDate", selected)
    }
  });
});

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script>
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" /> From:
<input type="text" id="txtFromDate" /> To:
<input type="text" id="txtToDate" />
&#13;
&#13;
&#13;

0 个答案:

没有答案
相关问题