O'Reilly logo

jQuery UI by Eric Sarrion

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The datepicker () Method

The datepicker () method can be used in two forms:

  • $(selector, context).datepicker (options)

  • $(selector, context).datepicker ("action", params)

The datepicker (options) Method

The datepicker (options) method declares that an <input> element (or <div> or <span>, depending on how you choose to display the calendar) should be managed as a datepicker. The options parameter is an object that specifies the appearance and behavior of the calendar. It can also specify the format for displaying dates in different countries.

Managing the appearance and visual effects associated with the calendar

The options listed in Table 8-1 allow us to set the appearance of the calendar.

Table 8-1. Options for managing the appearance of the calendar

Option

Function

options.firstDay

Integer that indicates which day begins a week on the calendar. The value 0 corresponds to Sunday (default).

options.numberOfMonths

Number of months displayed at the same time in the calendar. For example, a value of 3 indicates the calendar will display three consecutive months.

If it is indicated as an array, it is the number of rows and columns of months displayed. For example, [3, 2] for displaying six months, three on each line. The default is 1 (a single month).

options.showOtherMonths

If the first of the month does not fall on the day indicated in options.firstDay, unused cells at the beginning and end of the month can display days from the previous or following months.

The default value is false (days from ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required