Using jQuery Datepicker to display months only

I am looking to use the jQuery UI Datepicker so that the user can select a specific month, without being able to select a specific day in that month. The forward and backward buttons on Datepicker will use the user in different years instead of different months.

The format displayed in the Datepicker text box should be mm/yyyy. How can I do that?

+3
source share
2 answers

No, but you can do this:

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

Or look how you wondered:

Looking for JavaScript Month Picker

+1
source

2 ? - :

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);

, :

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

DDL , .

+1

Source: https://habr.com/ru/post/1726292/


All Articles