0

I'm using jQuery 1.9.1. I want to set a default date for my date picker (today's date), so I tried the suggestion from this post --Jquery DatePicker Set default date , which suggested trying two things. I tried

$( "#activationDate" ).datepicker({ defaultDate: new Date() });

but although I can see a date picker when I focus on my textbook, there is no default value filled into my textbook when the page loads. WHen I tried

$( "#activationDate" ).datepicker("setDate", new Date());

Nothing appeared and no datepicker came up when I clicked on my text box. How do I get a default value in the textbook AND have the date picker popup when I click on the text box?

Dave
  • 15,639
  • 133
  • 442
  • 830
  • 1
    The default date isn't put in the textbox, it's the initially selected date when the datepicker pops up. They still have to click on it. – Barmar Jan 30 '18 at 19:36
  • can you take a look to this [fiddle](https://jsfiddle.net/j7srf64n/). I assume you missed or messed some libraries – gaetanoM Jan 30 '18 at 20:04
  • 1
    @gaetanoM, yeah I didn't realize you have to call ".datepicker" twice, the second time to set the defautl date. This is what your Fiddle demonstrates, which I didn'tr ealize previously. – Dave Jan 31 '18 at 17:24

0 Answers0