简体   繁体   中英

How to disable dates after current date in javascript calender

I want to disable the dates after the current date in my program.

I have a date picker written in JavaScript.

My JavaScript code:

Click here to view my JavaScript code. Please help me in making necessary changes so as to disable the future date, ie dates up to current date are only to be displayed.

Is it too late to switch to jQuery and jQuery UI ? The jQuery UI Datepicker provides this functionality easily:

$(function() {
   $('#datepicker').datepicker({ maxDate: 0 });
});

http://jqueryui.com/demos/datepicker/#min-max

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM