我正在使用bootstrap和jQuery datepicker。当我单击日期字段时,并希望更改月份边框未正确显示。请看一下图片:
这是HTML:
<div class="col-sm-4 control-group" id="datepicker1">
<label for="dob" class="control-label">Date of Birth (A.D)</label>
<input type="text" id="datepicker" maxlength="20" value="${criteria.dateOfBirthAD}" class="form-control input-sm req" name="dateOfBirthAD"/>
</div>
和Javascript:
$("#datepicker").datepicker({
onSelect: function(value, ui) {
var today = new Date(),
dob = new Date(value),
m = today.getMonth() - dob.getMonth(),
age = today.getFullYear() - ui.selectedYear;
if (m < 0 || (m === 0 && today.getDate() < dob.getDate())) {
age--;
}
if (age < 18) {
$('#datepicker1').addClass('has-error');
jAlert("At least 18 year required for apply");
}
else {
$('#datepicker1').removeClass('has-error').addClass('has-success');
}
},
maxDate: new Date(),
changeMonth: true,
changeYear: true,
dateFormat: "yy/mm/dd"
});
答案 0 :(得分:2)
尝试缩小日期选择器的字体大小。
div.ui-datepicker {
font-size: 62.5%;
}