演示
时间选择器
$('#time2').attr('disabled', true);
$("#time").timepicker({
timeOnly: true,
timeFormat: 'hh:mm tt'
}).change(function () {
var val = this.value;
if (val !== '') {
var min = val.split(':');
var min1 = min[1].split(' ');
var minMin = parseInt(min1[0]);
var minHour = ((min1[1] == 'am') ? parseInt(min[0]) : parseInt(min[0]) + 12);
$('#time2').removeAttr('disabled').removeClass('hasDatepicker').timepicker({
timeOnly: true,
timeFormat: 'hh:mm tt',
hourMin: minHour,
}).change(function () {
var val_to = this.value;
var min_to = val_to.split(':');
var min1_to = min_to[1].split(' ');
var minMin_to = parseInt(min1_to[0]);
var minHour_to = ((min1_to[1] == 'am') ? parseInt(min_to[0]) : parseInt(min_to[0]) + 12);
if(minHour_to == minHour && minMin_to <= minMin){
this.value = val;
}
});
} else {
$('#time2').attr('disabled', true);
}
});