jQuery datepicker to prevent past date

后端 未结 15 2857
生来不讨喜
生来不讨喜 2020-12-04 16:34

How do I disable past dates on jQuery datepicker? I looked for options but don\'t seem to find anything that indicates the ability to disable past dates.

UPDATE: Th

15条回答
  •  囚心锁ツ
    2020-12-04 17:02

    Make sure you put multiple properties in the same line (since you only showed 1 line of code, you may have had the same problem I did).

    Mine would set the default date, but didn't gray out old dates. This doesn't work:

    $('#date_end').datepicker({ defaultDate: +31 })
    $('#date_end').datepicker({ minDate: 1 })
    

    This does both:

    $('#date_end').datepicker({ defaultDate: +31, minDate: 1 })
    

    1 and +1 work the same (or 0 and +0 in your case).

    Me: Windows 7 x64, Rails 3.2.3, Ruby 1.9.3

提交回复
热议问题