jQuery and ASP.NET

January 12, 2010

jQuery UI DatePicker – Display Multiple Months




Here’s how to display multiple months in the jQuery UI DatePicker using the ‘numberOfMonths’ option.

<label>Multiple Month DatePicker: </label>
<
input id="date2" />
<
script type="text/javascript">
$(function() {
var dt = {
numberOfMonths: 2
};
$("#date2").datepicker(dt);
});
</script>

image

You can even change the DatePicker UI using the different options available. For example, if you wanted to display the year as a dropdown field and also specify the range of years in the dropdown, use the following code:

<body>
<
label>Multiple Month DatePicker: </label>
<
input id="date2" />
<
script type="text/javascript">
$(function() {
var dt = {
changeYear: true,
yearRange: "-3:+3"
};
$("#date2").datepicker(dt);
});
</script>
</
body>

image

The UI shown above displays the year as a dropdown field and displays a range of 3 years both backwards and forward. You can check similar DatePicker options over here to configure the jQuery UI DatePicker


Bookmark this link on del.icio.us (saved by 0 users)

Did you like this post?
kick it on DotNetKicks.com
subscribe via rss subscribe via e-mail
print this post follow me on twitter
Others Also Read..

comments

1 Response to "jQuery UI DatePicker – Display Multiple Months"
  1. Anonymous said...
    January 13, 2010 4:49 PM

    Excellent tip, thanks very much for sharing, there is really smart material in this Web site.

 

Copyright 2010 All Rights Reserved DevCurry.com by Suprotim Agarwal