JQuery UIDatePicker - 设置最大日期
我正在尝试使用 jQuery 在我的 html 页面中设置 uidatepicker 的最大日期。我已经尝试过以下操作:
$(function() {
var theDate = new Date();
$( "#datepicker" ).datepicker(
{
dateFormat: 'dd/mm/yy',
maxDate: new Date(theDate.getYear(), theDate.getMonth(), theDate.getDate());
}
);
这不起作用......我做错了什么?我想让日期选择器具有今天日期的最大日期......
I am trying to set the max date for the uidatepicker in my html page using jQuery. I have tried the following:
$(function() {
var theDate = new Date();
$( "#datepicker" ).datepicker(
{
dateFormat: 'dd/mm/yy',
maxDate: new Date(theDate.getYear(), theDate.getMonth(), theDate.getDate());
}
);
This doesn't work....What am I doing wrong? I want to make it so the date picker has a max date of today's date...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
maxDate: ...
行末尾有一个不应该出现的;
。看起来这会导致语法错误。您的浏览器错误控制台是否告诉您存在某种 JavaScript 错误?
You have a
;
at the end of themaxDate: ...
line that shouldn't be there. Looks like it would result in a syntax error.Does your browser's error console tell you there's a JavaScript error of some kind?