0
votes

I am trying to reset the position of my datepicker calendar to today's date, and nothing works.

Among other things, I have tried

$('#selector').datepicker('setDate', '2014-01-01');

It looks like every function I call gives me the error Uncaught TypeError: undefined is not a function

1
What datepicker plugin are you using?Th4t Guy
eyecon.ro/bootstrap-datepicker, I think is version 2?user3180323

1 Answers

0
votes

I'm not sure where you are going wrong, but given this HTML:

<input type="text" id="my-date-picker">  

You can either set the date with a string like this:

$('#my-date-picker').datepicker('setValue', '01/02/2014');  

Or you can use a Date object and get today's date, or any other for that matter:

$('#my-date-picker').datepicker('setValue', new Date());        

Check out this JS Fiddle