我有一个代码,需要在同一页面上显示日期,它显示日期选择器,但不起作用。我可以选择日期,但不能选择
{
"list": [{
"name": "first",
"key": ["1", "2", "3"]
}, {
"name": "second",
"key": ["4", "5", "6"]
}]
}
这是JavaScript。
<div class="input-field" style="width:20%;float:left;padding-left:5px;">
<label for="dob">Start Date</label>
<input id="mcDateFrom" type="date" class="datepicker" />
</div>
<div class="input-field" style="width:20%;float:left;padding-left:5px;">
<label for="dob">End Date</label>
<input id="mcDateTo" type="date" class="datepicker" />
</div>
<div class="form-group col-sm-4" id="daysCount">
<label id="daysCount"> </label>
</div>
还是可以在同一个ID中运行两个JavaScript?当我从日期选择器中选择两个日期时,如何在脚本中运行以下代码,以检查表单显示结果在同一页面上?
<script>
var dateToday = new Date();
$('.datepicker').pickadate({
selectMonths: true,
selectYears: 40,
min: new Date(2018, 0, 1),
max: new Date(2020, 11, 31),
closeOnSelect: false,
});
$("#mcDateFrom").click(function(event) {
event.stopPropagation();
$(".datepicker").first().pickadate("picker").open();
});
$("#mcDateTo").click(function(event) {
event.stopPropagation();
$(".datepicker").first().pickadate("picker").open();
});</script>