【发布时间】:2020-04-05 14:23:00
【问题描述】:
我有两个输入字段用于开始日期和结束日期,如果用户选择开始日期,我需要在结束日期中选择 14 天,我该怎么做?
这里是我的html代码:
<label for="start_date">Date From</label>
<input id="start_date" required="true" width="276"/>
<label for="end_date">Date To</label>
<input id="end_date" required="true" width="276"/>
这里是我的脚本:
<script>
$('#start_date').datepicker({
uiLibrary: 'bootstrap4'
});
</script>
<script>
$('#end_date').datepicker({
uiLibrary: 'bootstrap4',
numberOfMonths: 2
});
</script>
【问题讨论】:
-
所以你想限制第二个日期选择器
-
完全正确,但我需要根据开始日期选择器进行限制
-
等等,我发现了你的问题。
-
已回答。简单使用最大和最小日期
标签: jquery datepicker jquery-ui-datepicker