0

I am using the JQuery Datepicker in which I want to set a static start date, where any date before the specified is either disabled or blanked out. I have tried using the MinDate setting but nothing has worked. Maybe I am misunderstanding what MinDate actually does?

Edit, here's the code I am trying (setting the minDate to 2015-12-01):

<script>
      $( function() {
        $( "#datepicker" ).datepicker({
        dateFormat: 'DD, d MM yy',
        minDate: new Date(2015, 12 - 1, 01)
        }) 
      });
</script>

As sourced from this page: Link

Cœur
  • 37,241
  • 25
  • 195
  • 267
MicrosoftDave
  • 301
  • 1
  • 3
  • 12
  • 1
    Please edit your question adding your code to show what you tried. See how to provide [Minimal, Complete, and Verifiable Examples](http://stackoverflow.com/help/mcve) – VincenzoC Feb 03 '17 at 09:29
  • @VincenzoC I added the code I am trying. – MicrosoftDave Feb 03 '17 at 18:48
  • There is nothing wrong in the code you shared, just check that you included all required resources (jQuery and jQuery UI) and the script is executed when `#datepicker` is already in the DOM. With your code dates before `2015-12-01` can't be selected as required. – VincenzoC Feb 05 '17 at 11:34
  • @VincenzoC How do I ensure the script is executed when #datepicker is already in the DOM? – MicrosoftDave Feb 05 '17 at 18:10
  • Simply put your code **after** the `#datepicker` input in the HTML, or place `$("#datepicker").datepicker(...)` inside [`ready()`](http://api.jquery.com/ready/) handler (as you are probably already doing). Can you provide a snippet or a fiddle showing your issue? Or maybe you can clarify further the problem you are having. – VincenzoC Feb 05 '17 at 22:07
  • @VincenzoC Thank you, I was placing the minDate in the wrong spot, once I put inside the ready() it worked. – MicrosoftDave Feb 06 '17 at 04:42

0 Answers0