Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 546
Eric Avatar asked Nov 18 '10 16:11

Eric


2 Answers

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] });
like image 161
David Avatar answered Oct 22 '22 01:10

David


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

Demo

Source below:

Source

like image 39
Aditya P Bhatt Avatar answered Oct 22 '22 01:10

Aditya P Bhatt