选择时间并提交表格后,我得到未定义 当我打开控制台时,没有任何错误。
$('.timepicker').timepicker({
timeFormat: 'h:mm p',
interval: 30,
minTime: '10',
maxTime: '3:00pm',
startTime: '10:00',
dynamic: true,
dropdown: true,
scrollbar: true
});
$(function () {
$("#datepicker").datepicker({
minDate: +1, maxDate: "+3M"
});
});
$(document).ready(function () {
var appointmentTime = document.getElementById('datepicker').value;
var splitData = "";
if (appointmentTime.indexOf("") > 0) {
splitData = appointmentTime.split(" ");
}
else {
splitData = appointmentTime.split("T");
}
var time = splitData[1].substring(0, 5);
if (time.slice(-1) == ":") {
time = time.substring(0, time.length - 1);
}
var amPmTime = splitData[2];
$('#datepicker').attr('value', splitData[0]);
$('#timepicker').attr('value', time + ' ' + amPmTime);
});
在我的领域,我得到这样的东西:
任何想法可能是什么问题?