Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 23rd, 2012  |  syntax: None  |  size: 0.91 KB  |  hits: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. jquery datepicker excluding a large number of dates
  2. $(function(){
  3.  
  4.     /* create an array of days which need to be disabled */
  5.     var disabledDays = ["1-14-1962","2-11-1962","3-22-1963","4-1-1963","6-9-1964","7-17-1964","8-9-65",  "1-2-66","4-1-66","8-3-67", "7-22-2011", "2-21-2010", "2-24-2010", "2-27-2010","2-28-2010", "3-3-2010","3-17-2010","4-2-2010", "4-3-2010","4-4-2010","4-5-2010", "7-22-2011"];
  6.  
  7.                 // Datepicker
  8.             $('#datepicker').datepicker({
  9.                 inline: true,
  10.                 dateFormat: 'yy-mm-dd', //Month & Day spelled out
  11.                 constrainInput: true,
  12.                 changeMonth: true,
  13.                 changeYear: true,
  14.                 maxDate: '0',
  15.                 yearRange: '-102y', //Going back to 1910
  16.     onSelect: function(dateText, inst) {
  17.                 window.location = 'http://www.example.com' + dateText;
  18.             }
  19.         });
  20.         });
  21.  
  22. <code>