views:

673

answers:

2

Hello, I'm looking to be able to use the JQuery UI Datepicker to allow a user to select a particular month, without the option to select a particular day in that month. The forward and previous buttons on the Datepicker would take the user to different years, instead of different months.

The format that appears in the Datepicker textbox needs to be mm/yyyy. Does anyone know how this can be done?

Thanks, Jack

A: 

No, but you could do this:

$("#somedate").datepicker( { dateFormat: "mm/yy" } );

Or look here since you're question has been asked before:

http://stackoverflow.com/questions/195768/in-search-of-javascript-month-picker

Nissan Fan
A: 

Why not making 2 dropdowns with months and year? something like:

var Months = ["January","February","March","April","May","June","July","August","September",  "October","November","December"];
var $selM = $('<select />');
$.each(Months,function(ind,item){

    $selM.append($('<option />').val(ind + 1).text(item));
});
$('span#Months').append($selM);

as for year you can get the current year by :

var now = new Date();
var year        = now.getYear();

then making another DDL for years with the range that you'd like to.

FrenchiInLa