我面临一个问题。我需要使用Jquery和Bootstrap为一个特定的日期字段设置mindate
。我在下面解释我的代码。
<p style="position: relative">
<input type="text" class="form-control date" value="" placeholder="Planned Date of Audit" id="planneddateofaudit" name="planneddateofaudit" readonly="" style="cursor:pointer; background-color:#fff;" />
</p>
<p style="position: relative">
<input type="text" class="form-control plan date" value="" placeholder="Planned Date" id="planneddate" name="planneddate" readonly="" style="cursor:pointer; background-color:#fff;" />
</p>
$(function()
{
var date1 = new Date();
var dd = date1.getDate();
var mm = date1.getMonth()+1;
var yyyy = date1.getFullYear();
var compareDate1 = new Date(yyyy,mm,dd);
compareDate1.setHours(0,0,0,0);
var todayDate = mm + "/" + dd + "/" + yyyy;
$('.plan .date').datetimepicker(
{
ignoreReadonly: true,
format: 'DD-MM-YYYY',
minDate: todayDate
});
$('.date').datetimepicker(
{
ignoreReadonly: true,
format: 'DD-MM-YYYY',
});
$('.datetime').datetimepicker(
{
format: 'DD-MM-YYYY hh:mm',
});
});
在这里,我需要为mindate
日期字段设置Planned Date
,而其他字段将保持不变。在我的情况下它没有按预期工作。 Here is my plunkr full code
答案 0 :(得分:0)
您必须替换: