Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

jQuery UI Examples - Datepicker

jQuery UI Examples - Datepicker

Select a date from a popup or inline calendar.

For more details about the datepicker widget, see the API documentation Datepicker Widget。

Default functionality

The datepicker is attached to a standard form input field. Move focus to the input (by clicking or tabbing) to open an interactive calendar in a small overlay. Select a date, click anywhere on the page (so the input loses focus), or press the Esc key to close. If a date is selected, the feedback appears as the input's value.









  

  jQuery UI 日期选择器(Datepicker) - 默认功能

  

  

  

  

  





 

日期:

Animation

Use different animations when opening or closing the datepicker. Choose an animation from the dropdown, then click in the input field to see its effect. You can use any of the three standard animations or any of the UI effects.









    

    jQuery UI 日期选择器(Datepicker) - 动画

    

    

    

    

    







日期:

动画:
    

Dates in other months

The datepicker can show dates from other months, and these can also be made selectable.









  

  jQuery UI 日期选择器(Datepicker) - 其他月份的日期

  

  

  

  

  





 

日期:

Show button panel

Through the boolean showButtonPanel option, displays a "Today" button for selecting today's date and a "Done" button for closing the calendar. By default, each button is enabled when the button panel is shown, but buttons can be disabled through other options. Button text can be customized.









  

  jQuery UI 日期选择器(Datepicker) - 显示按钮栏

  

  

  

  

  





 

日期:

Inline display

The datepicker is displayed inline in the page rather than in an overlay. Simply call .datepicker() on a div instead of on an input.









  

  jQuery UI 日期选择器(Datepicker) - 内联显示

  

  

  

  

  





 

日期:

Show month & year menu

Shows dropdowns for month and year instead of static month/year headers, making it easier to navigate over large time spans. Add the boolean changeMonth and changeYear option.









  

  jQuery UI 日期选择器(Datepicker) - 显示月份 & 年份菜单

  

  

  

  

  





 

日期:

Show multiple months

Settings numberOfMonths option to an integer of 2 or greater to display multiple months in a single datepicker.









  

  jQuery UI 日期选择器(Datepicker) - 显示多个月份

  

  

  

  

  





 

日期:

Formatting dates

Displays date feedback in various ways. Choose a date format from the dropdown, then click in the input field and select a date to see the date displayed in the chosen format.









  

  jQuery UI 日期选择器(Datepicker) - 格式化日期

  

  

  

  

  





 

日期:

格式选项:

Icon trigger

Click the icon next to the input field to show the datepicker. Set the datepicker to open on focus (the default behavior), on icon click, or on both focus and icon click.









  

  jQuery UI 日期选择器(Datepicker) - 图标触发器

  

  

  

  

  





 

日期:

Localized calendar

Localizes the datepicker calendar language and format (English / Western format by default). The datepicker includes built-in support for right-to-left languages such as Arabic and Hebrew.









  

  jQuery UI 日期选择器(Datepicker) - 本地化日历

  

  

  

  

  

  

  

  

  





 

日期: 

Populate another input

Use altField and altFormat option, whenever a date is selected, populates another input field with the date in a certain format. This feature takes a machine-friendly date and processes it further to present a user-friendly date to the user.









  

  jQuery UI 日期选择器(Datepicker) - 填充另一个输入框

  

  

  

  

  





 

日期: 

Restrict date range

Pass minDate and maxDate option restricts the range of selectable dates. Set the start and end dates to actual dates (new Date(2009, 1 - 1, 26)), to a numeric offset from today (-20), or to a string of periods and units ('+1M +10D'). If set to a string, use 'D' for days, 'W' for weeks, 'M' for months, and 'Y' for years.









  

  jQuery UI 日期选择器(Datepicker) - 限制日期范围

  

  

  

  

  





 

日期:

Select a date range

Select the date range to search.









  

  jQuery UI 日期选择器(Datepicker) - 选择一个日期范围

  

  

  

  

  





 









 

 





Show week number

The datepicker can show the week number of the year. By default, calculation follows the ISO 8601 definition: each week starts on Monday, and the first week of the year contains the year's first Thursday. This means some days of a year may belong to a week in another year.









  

  jQuery UI 日期选择器(Datepicker) - 显示一年中的第几周

  

  

  

  

  





 

日期: