用js的datapicker设置员工的出生时间与雇佣时间相差18岁,下面的代码一直报错,不知咋改,求大神指点 5
$(function(){$("#birthdate").datepicker({changeYear:true,maxDate:"-18Y",onClose:funct...
$(function() {
$( "#birthdate" ).datepicker({
changeYear: true,
maxDate:"-18Y",
onClose: function( selectedDate ) {
var d = selectedDate;
$( "#hiredate" ).datepicker(
"option", "minDate",
d.setFullYear(d.getFullYear()+18)
);
}
});
$( "#hiredate" ).datepicker({
changeYear:true,
maxDate:-1
});
}); 展开
$( "#birthdate" ).datepicker({
changeYear: true,
maxDate:"-18Y",
onClose: function( selectedDate ) {
var d = selectedDate;
$( "#hiredate" ).datepicker(
"option", "minDate",
d.setFullYear(d.getFullYear()+18)
);
}
});
$( "#hiredate" ).datepicker({
changeYear:true,
maxDate:-1
});
}); 展开
展开全部
参照这个改一下
$( function() {
var dateFormat = "mm/dd/yy",
from = $( "#from" )
.datepicker({
defaultDate: "+1w",
changeMonth: true,
numberOfMonths: 3
})
.on( "change", function() {
to.datepicker( "option", "minDate", getDate( this ) );
}),
to = $( "#to" ).datepicker({
defaultDate: "+1w",
changeMonth: true,
numberOfMonths: 3
})
.on( "change", function() {
from.datepicker( "option", "maxDate", getDate( this ) );
});
function getDate( element ) {
var date;
try {
date = $.datepicker.parseDate( dateFormat, element.value );
} catch( error ) {
date = null;
}
return date;
}
} );
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询