How to limit datepicker's max date to today? [duplicate]

放肆的年华 提交于 2019-12-23 07:07:46

问题


The questions is in the Title. I have two datepickers, from and to. I want to limit the from datepicker to the current date. How do I do that? Thanks in advance!


回答1:


Use the maxDate options : http://jqueryui.com/demos/datepicker/#option-maxDate

Set a maximum selectable date via a Date object or as a string in the current dateFormat, or a number of days from today (e.g. +7) or a string of values and periods ('y' for years, 'm' for months, 'w' for weeks, 'd' for days, e.g. '+1m +1w'), or null for no limit.

For example : $( ".selector" ).datepicker( "option", "maxDate", new Date() );



来源:https://stackoverflow.com/questions/8010448/how-to-limit-datepickers-max-date-to-today

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!