Eric
Eric

Reputation: 51

Jquery datepicker 2 months display

I'm using the jquery-ui datepicker for displaying multiple months.

The popup displays these months 1 below the other, is there a way to have the following month displayed to the right instead?

Upvotes: 5

Views: 29698

Answers (2)

David
David

Reputation: 4516

I'm working with this in datePicker right now :) So, well, according to jQuery dataPicker documentation:

numberOfMonths

Number, Array 
Default:1

Set how many months to show at once. The value can be a straight integer, or can be a two-element array to define the number of rows and columns to display. Code examples

Initialize a datepicker with the numberOfMonths option specified.

$( ".selector" ).datepicker({ numberOfMonths: [2, 3] });

Get or set the numberOfMonths option, after init.

//getter
var numberOfMonths = $( ".selector" ).datepicker( "option", "numberOfMonths" );
//setter
$( ".selector" ).datepicker( "option", "numberOfMonths", [2, 3] );

So as fas as I tried if you write

$( ".selector" ).datepicker({ numberOfMonths: 2 }); 

it appears 2 months, one by the side of the other, in a row, horizontally. And In the case you want to display them vertically, in a column you should write

$( ".selector" ).datepicker({ numberOfMonths: [2, 1] });

Upvotes: 21

Aditya P Bhatt
Aditya P Bhatt

Reputation: 22071

Here is a very simple jQuery Datepicker with multiple months display option:

Demo

Source below:

Source

Upvotes: 1

Related Questions