javascript - Jquery DatePicker YearRange based on current month -
I'm using datepicker for jQuery and I want to know if this yearRange change properties based on current month Is possible for In my case, if the month is different from November or December yearRange its current year otherwise this current year + 1 example is 1 : on average in April Example 2: Current month: November Thanks!
.datepicker ({showOn: "buttons", buttonImageOnly: true, changeMonth: true, changeYear: true , YearRange: '-12: +0':
.datepicker ({showOn: "buttons", buttonImage: "../../App_Themes/Samae/images/calendar.png", buttonImageOnly: true, changeMonth: true, changeYear: true, yearRange: '-12: +1'
< Str Ong> jQuery code
$ (function () {var d = new date (); var month = d.getMonth (); var category ; If (month == 10 || months == 11) {range = '-12: +1';} and {class = '-12: +0';} $ ('# txtDate'). Datepicker ({ ChangeMonth: true, changeYear: true, yearreange: range}); });
You can work by changing the status and changing it to if (month == 03 || month == 11)
.
Optional
$ (function () {var d = new date (); var month = d .getMonth (); $ ('# txtDate') datepicker ({changeMonth: true., ChangeYear: true, yearRange: (months == 10 || months == 11) '-12: +1': ' -12: +0 '});});
Comments
Post a Comment