javascript - JQuery Monthpicker - Displaying the previous two months as options -
i saw jquery monthpicker helped me. jquery ui datepicker show month year only
but need monthpicker display last 2 months in options, apart current month.
eg. since current month june 2014, monthpicker should display may , april 2014, apart june.
can me out here?
set mindate
, maxdate
properties on object being passed argument datepicker
function:
$("#picker").datepicker({ mindate: "-2m", maxdate: 0, changemonth: true, changeyear: true, showbuttonpanel: true, dateformat: 'mm yy', onclose: function(datetext, inst) { var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val(); var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val(); $(this).datepicker('setdate', new date(year, month, 1)); } });
js fiddle: http://jsfiddle.net/arftr/1/
Comments
Post a Comment