当前位置 : 主页 > 网络编程 > JavaScript >

datetimepickper起止时间前后约束限制

来源:互联网 收集:自由互联 发布时间:2021-07-03
datetimepickper起止时间前后约束限制,备忘。 1. [代码] [JavaScript]代码 var DatetimePicker={beginEndConstraint:function($begin,$end){$begin.datetimepicker('setOptions',{onShow:function(date, $ele, $event){if($end.val()=='')
datetimepickper起止时间前后约束限制,备忘。

1. [代码][JavaScript]代码    

var DatetimePicker={
	beginEndConstraint:function($begin,$end){
		$begin.datetimepicker('setOptions',{
			onShow:function(date, $ele, $event){
				if($end.val()=='')
					$begin.datetimepicker('setOptions',{maxDate:false});
			},
			onSelectDate: function (date, $ele, $event) {
				$end.datetimepicker('setOptions',{minDate:date});
			},
			onSelectTime: function (date, $ele, $event) {
				$end.datetimepicker('setOptions',{minDate:date});
			}
		});
		$end.datetimepicker('setOptions',{
			onShow:function(date, $ele, $event){
				if($begin.val()=='')
					$end.datetimepicker('setOptions',{minDate:false});
			},
			onSelectDate: function (date, $ele, $event) {
				$begin.datetimepicker('setOptions',{maxDate:date});
			},
			onSelectTime: function (date, $ele, $event) {
				$begin.datetimepicker('setOptions',{maxDate:date});
			}
		});
	}
};
网友评论