我是编码世界的新手。我正在使用bootstrap创建一个网页,以便在页面中显示“开始日期”和“结束日期”。但问题是我不知道如何使结束日期始终大于开始日期。我在这里粘贴了我从互联网上获得的代码。任何帮助将不胜感激This is how the page looks like right now
<script>
$(document).ready(function() {
$('#dateRangePicker')
.datepicker({
format: 'mm/dd/yyyy',
startDate: '01/01/2010',
endDate: '12/30/2020'
})
.on('changeDate', function(e) {
// Revalidate the date field
$('#dateRangeForm').formValidation('revalidateField', 'date');
});
$('#dateRangePicker1')
.datepicker({
format: 'mm/dd/yyyy',
startDate: '01/01/2010',
endDate: '12/30/2020'
})
.on('changeDate', function(e) {
// Revalidate the date field
$('#dateRangeForm').formValidation('revalidateField', 'date');
});
$('#dateRangeForm').formValidation({
framework: 'bootstrap',
icon: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
date: {
validators: {
notEmpty: {
message: 'The date is required'
},
date: {
format: 'MM/DD/YYYY',
min: '01/01/2010',
max: '12/30/2020',
message: 'The date is not a valid'
}
}
}
}
});
});
</script>
<div class="form-group">
<label class="control-label col-sm-3">Start Date</label>
<div class="col-sm-6">
<div class="input-group input-append date" id="dateRangePicker">
<input type="text" class="form-control" name="date" />
<span class="input-group-addon add-on"><span class="glyphicon glyphicon-calendar"></span></span>
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-3">End Date</label>
<div class="col-sm-6">
<div class="input-group input-append date" id="dateRangePicker1">
<input type="text" class="form-control" name="date" />
<span class="input-group-addon add-on"><span class="glyphicon glyphicon-calendar"></span></span>
</div>
</div>
</div>