jquery - Set datepicker default date -
I'm new to jQuery, I'm trying to set the default dates of two text boxes so that they will open on the page When the page opens I want to do the search start at the end of the current year 01/01 / today's default. This is my code and it does not work:
(& lt; any & gt; $ ('# searchStart')) datepicker ({dateFormat: 'dd / mm / yy', DefaultDate: '01 / 01 / '+ Fullwire ()}); (& Lt; any & gt; $ ('# searchEnd')) DateTime ({dateFormat: 'dd / mm / yy' defaultDate: new date ()});
For the current date, you can do var theDate = $ .datepicker .formatDate ('dd / mm / yy', new date ());
and input your .val (theDate)
.
For another:
var theYear = $ .datepicker.formatDate ('yy', new date ()); $ ('Input'). Val ('01 / 01 / '+ year); $ ('Input'). Date picture ({dateFormat: 'dd / mm / yy', defaultDate: '01 / 01 / '+ year));
Comments
Post a Comment