// shall I write some keywords here to boost search engine ranking?

Saturday, March 19, 2011

JQuery UI: Datepicker with Month and Year only

This can be done by hiding the calendar via some CSS trick:

4 comments:

Anonymous said...

Good post !
I made a small modification on the onClose function to be more generic, so it can be used on multiple inputs with different dateFormat.

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));
$(this).datepicker('refresh');
}

guru said...

give me demo option

Wikki said...

How do I only have years selection from date picker

Ulysses Alves said...

It would be very helpfull if you had placed a picture of the final result of the datepicker, so we shouldn't need to test it by ourselves to decide if we'll use or not the approach.