日期选择器| jQuery UI

Full calendar datepicker. If you are not familiar with jquery ui, and you are looking for a way to add a datepicker to your website, it would be superfluous to read this article, where we will tell how to add and configure datepicker. It’s easy enough if you are already familiar with this library, but it will be very useful for beginners. This tutorial is also provided by several illustrative examples which you can try online.

完整的日历日期选择器。 如果您不熟悉jquery ui,并且正在寻找一种向网站添加日期选择器的方法,那么阅读本文将是多余的,我们将在其中告诉您如何添加和配置日期选择器。 如果您已经熟悉此库,这很容易,但是对于初学者来说将非常有用。 本教程还提供了一些说明性示例,您可以在线尝试这些示例。

First at all, you can download jQuery UI library here. Now, you can prepare an empty HTML file and add next code:

首先,您可以在此处下载jQuery UI库。 现在,您可以准备一个空HTML文件并添加下一个代码:


    <!-- add styles -->
    <link href="css/ui-lightness/jquery-ui-1.9.2.custom.min.css" rel="stylesheet" type="text/css" />
    <!-- add scripts -->
    <script src="js/jquery.191.js"></script>
    <script src="js/jquery-ui-1.9.2.custom.min.js"></script>

    <!-- add styles -->
    <link href="css/ui-lightness/jquery-ui-1.9.2.custom.min.css" rel="stylesheet" type="text/css" />
    <!-- add scripts -->
    <script src="js/jquery.191.js"></script>
    <script src="js/jquery-ui-1.9.2.custom.min.js"></script>

Please pay attention, that you will need to put all the files of jQuery UI to appropriate folders (let’s keep all JS files in ‘js’ folder and all CSS in ‘css’ folder). Well, we have just linked all the necessary libraries and styles. Now, in order to add a calendar, we need to add a single line:

请注意,您需要将jQuery UI的所有文件都放在适当的文件夹中(让所有JS文件保留在“ js”文件夹中,所有CSS保留在“ css”文件夹中)。 好吧,我们已经链接了所有必需的库和样式。 现在,为了添加日历,我们需要添加一行:


<input id="datepicker" type="text" />

<input id="datepicker" type="text" />

It is also possible to add this as an inline-object. In this case we don’t need to specify ‘type’ param:

也可以将其添加为内联对象。 在这种情况下,我们不需要指定'type'参数:


<div id="datepicker"></div>

<div id="datepicker"></div>

Finally, to complete this page and to initialize our datepicker, let’s add some JS code:

最后,为了完成此页面并初始化我们的日期选择器,让我们添加一些JS代码:


<script>
$(function(){
  $.datepicker.setDefaults(
    $.extend($.datepicker.regional[''])
  );
  $('#datepicker').datepicker();
});
</script>

<script>
$(function(){
  $.datepicker.setDefaults(
    $.extend($.datepicker.regional[''])
  );
  $('#datepicker').datepicker();
});
</script>

现场演示1

By default, the main interface is in English. But, you easily can change it via options, let’s say – German interface:

默认情况下,主界面为英文。 但是,您可以轻松地通过选项进行更改,例如,德语界面:


$('#datepicker').datepicker('option', $.datepicker.regional['de']);

$('#datepicker').datepicker('option', $.datepicker.regional['de']);

现场演示2

We also can modify another params, for instance minDate and maxDate:

我们还可以修改其他参数,例如minDate和maxDate:


$('#datepicker').datepicker({
  minDate: '-30', // The min date that can be selected, i.e. 30 days from the 'now'
  maxDate: '+1m +1w +1d' // The max date that can be selected, i.e. + 1 month, 1 week, and 1 days from 'now'
});

$('#datepicker').datepicker({
  minDate: '-30', // The min date that can be selected, i.e. 30 days from the 'now'
  maxDate: '+1m +1w +1d' // The max date that can be selected, i.e. + 1 month, 1 week, and 1 days from 'now'
});

现场演示3

大事记 (Events)

This is an example how you can add your events:

这是一个如何添加事件的示例:


$.datepicker.setDefaults($.extend(
  $.datepicker.regional[''])
);
$('#datepicker').datepicker({
  beforeShow: function(input) {
    $(input).css('background-color','#ff0');
  },
  onSelect: function(dateText, obj) {
    $(this).css('background-color','');
    alert('Selected: ' + dateText +
      "\n\nid: " + obj.id +
      "\nselectedDay: " + obj.selectedDay +
      "\nselectedMonth: " + obj.selectedMonth +
      "\nselectedYear: " + obj.selectedYear);
  },
  onClose: function(dateText, obj) {
    $(this).css('background-color','');
  }
});

$.datepicker.setDefaults($.extend(
  $.datepicker.regional[''])
);
$('#datepicker').datepicker({
  beforeShow: function(input) {
    $(input).css('background-color','#ff0');
  },
  onSelect: function(dateText, obj) {
    $(this).css('background-color','');
    alert('Selected: ' + dateText +
      "\n\nid: " + obj.id +
      "\nselectedDay: " + obj.selectedDay +
      "\nselectedMonth: " + obj.selectedMonth +
      "\nselectedYear: " + obj.selectedYear);
  },
  onClose: function(dateText, obj) {
    $(this).css('background-color','');
  }
});

现场演示4

There are three event handlers: beforeShow – this function is triggered before the calendar is shown. With the help of css-option the INPUT will be set to yellow background. onSelect is triggered when you select a date, it alerts the selected date (with other params) and nullifies the value of background-color. onClose function is triggered when we have closed the calendar.

有三个事件处理程序: beforeShow –在显示日历之前触发此函数。 借助css-option,输入将设置为黄色背景。 当您选择一个日期时, onSelect会被触发,它会警告选定的日期(带有其他参数),并使background-color的值无效。 关闭日历后会触发onClose函数。

方法 (Methods)


<a id="datepicker_open">Open in a window</a>

<a id="datepicker_open">Open in a window</a>


$(function(){
    $.datepicker.setDefaults(
        $.extend($.datepicker.regional[''])
    );
    $('#datepicker_open').click(function(){
        $('#datepicker').datepicker(
            'dialog',
            '28.05.2013',
            function(){
                alert('Event onSelect');
            },
            { showButtonPanel: true }
        );
    });
});

$(function(){
    $.datepicker.setDefaults(
        $.extend($.datepicker.regional[''])
    );
    $('#datepicker_open').click(function(){
        $('#datepicker').datepicker(
            'dialog',
            '28.05.2013',
            function(){
                alert('Event onSelect');
            },
            { showButtonPanel: true }
        );
    });
});

现场演示5

[sociallocker]

[社交储物柜]

包中的所有示例

[/sociallocker]

[/ sociallocker]

This example demonstrates the dialog method. When we click on the link, it invokes the function. The first argument is the name of the method, the second argument textDate – the default date on which the calendar opens. In the argument onSelect we can set callback-function which will be invoked when you have selected a certain date in the calendar. In the argument settings you can define an object with the new widget settings that could be applied to the calendar.

本示例演示了对话方法。 当我们单击链接时,它将调用该函数。 第一个参数是方法的名称,第二个参数是textDate –日历打开的默认日期。 在参数onSelect中,我们可以设置回调函数,当您在日历中选择某个日期时将调用该函数。 在参数设置中,您可以定义具有可应用于日历的新窗口小部件设置的对象。

日期选择器选项: (Datepicker Options:)

  • altField – jQuery selector for another field which should be updated when a date is selected from the Datepicker. The date format in this additional field is set with the option altFormat.

    altField –另一个字段的jQuery选择器,当从Datepicker中选择日期时,该字段应更新。 此附加字段中的日期格式是使用altFormat选项设置的。

  • altFormat – the date format which will be used for altField option. These settings allow the user to see one date format, whereas for the calculations a different format can be used. A complete list of formats can be found here http://docs.jquery.com/UI/Datepicker/formatDate

    altFormat –将用于altField选项的日期格式。 这些设置允许用户查看一种日期格式,而对于计算则可以使用另一种格式。 有关格式的完整列表,请参见http://docs.jquery.com/UI/Datepicker/formatDate

  • appendText – text which is displayed after each date input field. Can be used, for example, to mark the field as required.

    appendText –在每个日期输入字段之后显示的文本。 例如,可用于标记所需的字段。

  • buttonImage – address of the button’s popup image, which can be used to call the calendar. Used in conjunction with showOn, when it has the values “button” or “both”. If the text has been set in the option buttonText, it becomes the value of the attribute alt of the image and is not displayed.

    buttonImage –按钮的弹出图像的地址,可用于调用日历。 当其值为“ button”或“ both”时,与showOn结合使用。 如果在选项buttonText中设置了文本,则该文本将成为图像的属性alt的值,并且不会显示。

  • buttonImageOnly – if this option is true, the image, whose address is defined in the option buttonImage, will appear not on the button, but by itself and will work as a trigger.

    buttonImageOnly –如果此选项为true,则其地址在选项buttonImage中定义的图像将不显示在按钮上,而是单独显示,并作为触发器。

  • buttonText – the text that will be displayed on the button, which you can use to call the calendar. Used in conjunction with showOn, when it has the values “button” or “both”.

    buttonText –将显示在按钮上的文本,您可以使用它来调用日历。 当其值为“ button”或“ both”时,与showOn结合使用。

  • changeMonth – if this option is enabled by setting the value as true, it will allow to select the month from the drop-down list.

    changeMonth –如果通过将值设置为true启用此选项,它将允许从下拉列表中选择月份。

  • changeYear – if this option is enabled by setting the value as true, it will allow to select the year from the drop-down list.

    changeYear –如果通过将值设置为true启用此选项,则可以从下拉列表中选择年份。

  • closeText – this option is used in conjunction with showButtonPanel, if the latter is set to true. The value of the option closeText is defined in the localization file, if it is in use, but this value can be redefined by specifying it.

    closeText –如果showButtonPanel设置为true,则此选项与showButtonPanel结合使用。 选项closeText的值在本地化文件中定义(如果正在使用),但是可以通过指定该值来重新定义它。

  • constrainInput – by default this option is set to true, and constrains the date format, defined in the options of the widget, in the input field. If you don’t want to follow this format, set the option to false.

    constrainInput –默认情况下,此选项设置为true,并在输入字段中约束在小部件的选项中定义的日期格式。 如果您不想遵循这种格式,请将选项设置为false。

  • currentText – is used in conjunction with showButtonPanel, if the latter is set to true. The value of currentText option is defined in the localization file, if it is in use, but this value can be redefined by specifying it.

    currentText –如果showButtonPanel设置为true,则与showButtonPanel结合使用。 currentText选项的值在本地化文件中定义(如果正在使用),但是可以通过指定该值来重新定义它。

  • dateFormat – defines the format of the date. The value of dateFormat option is defined in the localization file, if it is in use, but this value can be redefined by specifying it. A complete list of all the formats can be found here http://docs.jquery.com/UI/Datepicker/formatDate

    dateFormat –定义日期的格式。 如果使用了dateFormat选项,则在本地化文件中定义它的值,但是可以通过指定该值来重新定义它。 有关所有格式的完整列表,请参见http://docs.jquery.com/UI/Datepicker/formatDate

  • dayNames – an array containing the long names of the days of the week, starting from Sunday. Defined in the localization file, if it is in use, but this value can be redefined by specifying it.

    dayNames –一个数组,其中包含从星期日开始的一周中各天的长名称。 在本地化文件中定义(如果正在使用),但是可以通过指定该值来重新定义它。

  • dayNamesMin – an array of minimized 2-character names for days of the week, starting from Sunday. Defined in the localization file, if it is in use, but this value can be redefined by specifying it.

    dayNamesMin –从星期天开始,在一周中的几天中由最少2个字符组成的名称数组。 在本地化文件中定义(如果正在使用),但是可以通过指定该值来重新定义它。

  • dayNamesShort – an array of minimized 3-character names for days of the week, starting from Sunday. Defined in the localization file, if it is in use, but this value can be redefined by specifying it.

    dayNamesShort –从星期天开始,在一周中的几天中,由最少3个字符组成的名称数组。 在本地化文件中定义(如果正在使用),但是可以通过指定该值来重新定义它。

  • defaultDate – sets the date, which will be highlighted on the first opening if the date field is empty. The option can be specified through the object Date, or as a number of days from the current day (e.g. +7 or -15), or as a string of values, which determine period (“y” for years, “m” for months, “w” for weeks, “d” for days, e.g. “+1 m +7 d”), and finally as null for current day.

    defaultDate –设置日期,如果日期字段为空,它将在第一个开口处突出显示。 该选项可以通过对象Date指定,也可以指定为当前日期的天数(例如+7或-15),也可以指定为确定周期(“ y”表示年份,“ m”表示年份)的一串值。月,“ w”代表星期,“ d”代表几天,例如“ +1 m +7 d”),最后一天则为null。

  • duration – the duration of the animation effect when opening (closing) the calendar. Can have values of speeds in a string – “fast”, “normal” (default), “slow” or time-number in milliseconds. If you leave the string empty, the calendar will be opened and closed without animation effects.

    持续时间 –打开(关闭)日历时动画效果的持续时间。 可以在字符串中包含速度值–“快速”,“正常”(默认),“慢”或时间值(以毫秒为单位)。 如果将字符串留空,则日历将被打开和关闭而没有动画效果。

  • firstDay – sets the first day of the week: Sunday – 0, Monday – 1,… Defined in the localization file, if it is in use, but this value can be redefined by specifying it.

    firstDay –设置一周中的第一天:星期日– 0,星期一– 1,…在本地化文件中定义(如果正在使用),但是可以通过指定该值来重新定义。

  • gotoCurrent – if this option is set to true, the button “Today” (only with showButtonPanel set to true) will point at the selected date instead of the current one.

    gotoCurrent –如果此选项设置为true,则“ Today”按钮(仅将showButtonPanel设置为true)将指向所选日期,而不是当前日期。

  • hideIfNoPrevNext – if you constrain the range of available dates with options minDate and maxDate, then when you reach the end of the range, arrows “Back” and “Forward” will be disabled. But they can be completely hidden, by setting option hideIfNoPrevNext to true.

    hideIfNoPrevNext –如果使用选项minDate和maxDate限制可用日期的范围,则当到达范围的末尾时,将禁用箭头“后退”和“前进”。 但是通过将选项hideIfNoPrevNext设置为true可以完全隐藏它们。

  • isRTL – this option must be set to true, if you are using a language written from right-to-left. Defined in the localization file, if it is in use.

    isRTL –如果使用从右到左书写的语言,则必须将此选项设置为true。 在本地化文件中定义(如果正在使用)。

  • maxDate – sets the maximum possible selectable date through the object Date, or as a number of days from the current day (e.g. +7), or as a string of values, which determine period (“y” for years, “m” for months, “w” for weeks, “d” for days, e.g. “+1 y +1 d”), or null for no limit.

    maxDate –通过对象Date设置最大可能的可选日期,或者设置为从当前日期开始的天数(例如+7),或者设置为一串值 ,这些值确定期间(“ y”代表年份,“ m”代表年份)月,“ w”代表周,“ d”代表天,例如“ +1 y +1 d”),或者为null则没有限制。

  • minDate – sets minimum selectable date via Date object, or as a number of days from the current day (eg -7), or as a string of values, which determine period (“y” for years, “m” for months, “w” for weeks, “d” for days, e.g. “-1y-1m”), or null for no limit.

    minDate –通过Date对象设置最小可选日期,或者设置为从当前日期开始的天数(例如-7),或者设置为确定周期(“ y”表示年份,“ m”表示月份,“ w”代表数周,“ d”代表数天,例如“ -1y-1m”),null代表无限制。

  • monthNames – an array containing the long month names. Defined in the localization file, if it is in use, but this value can be redefined by specifying it.

    monthNames –包含长月份名称的数组。 在本地化文件中定义(如果正在使用),但是可以通过指定该值来重新定义它。

  • monthNamesShort – an array of abbreviated months names to 3-character. Defined in the localization file, if it is in use, but this value can be redefined by specifying it.

    monthNamesShort –缩写的月份名称数组,长度为3个字符。 在本地化文件中定义(如果正在使用),但是可以通过指定该值来重新定义它。

  • navigationAsDateFormat – by default the option is set to false. If set true, the function dateFormat will be applied to the values of the options nextText, prevText and currentText in order to display the previous and next month names when navigating.

    navigationAsDateFormat –默认情况下,此选项设置为false。 如果设置为true,则将dateFormat函数应用于选项nextText,prevText和currentText的值,以便在导航时显示上个月和下个月的名称。

  • nextText – the text displayed as a link for the next month. Defined in the localization file, if it is in use, but this value can be redefined by specifying it. If you use a stylesheet file ThemeRoller, this value is replaced by an icon.

    nextText –显示为下个月链接的文本。 在本地化文件中定义(如果正在使用),但是可以通过指定该值来重新定义它。 如果使用样式表文件ThemeRoller,则此值将替换为图标。

  • numberOfMonths – This option sets the number of months to show at the same time. The value of the option may be either a number (straight integer) or an array consisting of two elements, which define, respectively, the number of rows and columns. For example, with two-elements [2, 3] the calendar will be displayed in two rows each having three months.

    numberOfMonths –此选项设置要同时显示的月份数。 该选项的值可以是数字(整数),也可以是由两个元素组成的数组,这两个元素分别定义行数和列数。 例如,使用两个元素[2,3],日历将显示在两行中,每行显示三个月。

  • prevText – the text displayed as a link to the previous month. Defined in the localization file, if it is in use, but this value can be redefined by specifying it. If you use a stylesheet file ThemeRoller, this value is replaced by an icon.

    prevText –显示为上个月链接的文本。 在本地化文件中定义(如果正在使用),但是可以通过指定该值来重新定义它。 如果使用样式表文件ThemeRoller,则此值将替换为图标。

  • shortYearCutoff – by default +10. This option is used only if you use in dateFormat two-digit year format and serves as a compensator for determining the century. If the value is provided as a number, then it is used directly. If the value is provided as a string, then it is converted to a number and added to the current year. Once the value of the cutoff year is determined, any dates, with a year value less than or equal to it are considered as of this century. Greater values – are considered as of the previous century.

    shortYearCutoff –默认情况下为+10。 仅当您使用两位数的dateFormat年格式并用作确定世纪的补偿器时,才使用此选项。 如果该值以数字形式提供,则可以直接使用。 如果该值以字符串形式提供,则将其转换为数字并添加到当前年份。 一旦确定了截止年份的值,则认为年份值小于或等于该年份的任何日期都被视为本世纪。 更高的价值–被认为是上个世纪的价值。

  • showAnim – determines the type of animation when you open the calendar. By defaults set to show (when closing hide will be used). Without connecting additional files you can use the effects of “slideDown” and “fadeIn” (when closing, respectively, the effects of “slideUp” and “fadeout” will be used). You can also use any effects in jQuery UI Effects of course, only if you additionally connect them.

    showAnim –确定打开日历时的动画类型。 默认情况下设置为显示(将在关闭时使用隐藏)。 在不连接其他文件的情况下,您可以使用“ slideDown”和“ fadeIn”的效果(当关闭时,将分别使用“ slideUp”和“ fadeout”的效果)。 当然,您也可以在jQuery UI效果中使用任何效果,除非您另外连接它们。

  • showButtonPanel – setting the value to true for this option will cause that the panel will display two buttons – “jump to current date” and “closing the calendar”.

    showButtonPanel –将此选项的值设置为true将导致面板显示两个按钮-“跳转到当前日期”和“关闭日历”。

  • showCurrentAsPos – when displaying multi-month, the number provided to this option determines the position of the current month. The default value is 0, and the current month is displayed in the top left corner.

    showCurrentAsPos –显示多月时,此选项提供的数字确定当月的位置。 默认值为0,当前月份显示在左上角。

  • showMonthAfterYear – by default the value is set false and the header name of the month comes before the year. If set to true, name of the month will go after year.

    showMonthAfterYear –默认情况下,该值设置为false,并且月份的标题名称在年​​份之前。 如果设置为true,则月份名称将在年份之后。

  • showOn – by default this option is set to “focus”, this makes the calendar appear when you click in the input field. Other possible values are – “button” and “both”. Next to the input field a button will appear. In the case of “button”, the calendar will open by clicking on the button, in the second case, by clicking on the button, as well as, by receiving focus to the input field.

    showOn –默认情况下,此选项设置为“ focus”,这使日历在您单击输入字段时显示。 其他可能的值是–“按钮”和“两者”。 输入字段旁边将出现一个按钮。 在“按钮”的情况下,将通过单击按钮来打开日历,在第二种情况下,将通过单击按钮以及通过将焦点接收到输入字段来打开日历。

  • showOptions – if you use one of the effects of jQuery UI Effects, via this option, it is possible to provide additional settings for the animation. For example: showOptions: {direction: “up”}.

    showOptions –如果您使用jQuery UI Effects的效果之一,则可以通过此选项为动画提供其他设置。 例如:showOptions:{方向:“向上”}。

  • showOtherMonths – by default set to false. If set to true, this will display on the calendar days preceding and/or following month, which is non-selectable.

    showOtherMonths –默认情况下设置为false。 如果设置为true,它将显示在不可选择的月份之前和/或之后的日历天。

  • stepMonths – set how many months to move in the calendar when clicking on “Next” and “Previous” links. By default it’s 1 month shift.

    stepMonths –设置单击“下一个”和“上一个”链接时日历中要移动多少个月。 默认情况下为1个月轮班。

  • yearRange – control how many years to display in the drop-down list (when using the option changeYear).

    yearRange –控制下拉列表中显示的年份(使用选项changeYear时)。

大事记: (Events:)

  • beforeShow – here you can define the function that will be called just before the calendar is opened. The function takes as argument an object that describes the input field which the widget is working with.

    beforeShow –在这里您可以定义在日历打开之前将要调用的函数。 该函数将描述小部件正在使用的输入字段的对象作为参数。

  • beforeShowDay – with this option you can set the customized function which takes the selected date as an argument. The function must return an array, where the element with index equal to [0] – true or false indicates whether or not the selection of this date is possible. The element with index [1] contains the class name (-s) to display the date. The element with index [2] (optional) – the popup tooltip for the date. The function will be called for every date in the calendar if hovered over it with the mouse cursor.

    beforeShowDay –使用此选项,您可以设置自定义函数,该函数将所选日期作为参数。 该函数必须返回一个数组,其中索引等于[0]的元素– true或false指示是否可以选择此日期。 索引为[1]的元素包含用于显示日期的类名称(-s)。 索引为[2]的元素(可选)–日期的弹出工具提示。 如果使用鼠标光标将其悬停在日历上的每个日期上,则会调用该函数。

  • onChangeMonthYear – here you can define the function which will be called every time you change the month or the year in the calendar. The function has three arguments. The first two arguments – are the new year and month, the third argument – datepicker object.

    onChangeMonthYear –您可以在此处定义每次在日历中更改月份或年份时都会调用的函数。 该函数具有三个参数。 前两个参数是新年和月份,第三个参数是datepicker对象。

  • onClose – with this option you can define the function to be called if the calendar was closed without any date being selected.

    onClose –使用此选项,您可以定义在未选择任何日期的情况下关闭日历时要调用的函数。

  • onSelect – this option defines the function that will be called if any date is selected in the calendar.

    onSelect –此选项定义在日历中选择任何日期时将调用的函数。

方法: (Methods:)

  • destroy – .datepicker(“destroy”) removes completely the functionality of the widget Datepicker. Returns the elements into pre-initialization state.

    destroy – .datepicker(“ destroy”)完全删除小部件Datepicker的功能。 使元素返回到预初始化状态。

  • disable – .datepicker(“disable”) temporarily disables all the functionality of the widget. To re-enable it, use the method enable.

    disable – .datepicker(“ disable”)暂时禁用小部件的所有功能。 要重新启用它,请使用enable方法。

  • enable – .datepicker(“enable”) enables the use of all the functionality of the widget, if it was prior disabled by the method disable.

    enable – .datepicker(“ enable”)启用窗口小部件的所有功能,如果该窗口小部件先前是通过禁用方法禁用的。

  • option – .datepicker(“option”, optionName, [value]) by using this method you can get or set the value of any widget option after initialization.

    option – .datepicker(“ option”,optionName,[value])通过使用此方法,可以在初始化后获取或设置任何小部件选项的值。

  • dialog – .datepicker(“dialog”, dateText, [onSelect], [settings], [pos]) opens the Datepicker in the dialog mode. In the argument dateText a date is provided, on which the calendar is opened. Other arguments are optional. In the argument OnSelect a function can be passed, which will be called when selecting a date in the calendar, in the argument settings an object can passed with new widget settings, in the argument pos – coordinated, on which a dialog field will be open. You can use the mouse events, to determine the coordinates.

    对话框 – .datepicker(“对话框”,dateText,[onSelect],[设置],[pos])在对话框模式下打开Datepicker。 在参数dateText中,提供了一个日期,在该日期上打开了日历。 其他参数是可选的。 在参数OnSelect中可以传递一个函数,在日历中选择日期时将调用该函数;在参数设置中,对象可以通过新的窗口小部件设置传递;在pos –协调参数中,将打开一个对话框字段。 您可以使用鼠标事件来确定坐标。

  • isDisabled – .datepicker(“isDisabled”) the method returns true, if to the widget the method disable was used, and false if not.

    isDisabled – .datepicker(“ isDisabled”)如果对小部件使用了禁用方法,则该方法返回true,否则返回false。

  • hide – .datepicker(“hide”, [speed]) hides the previously opened calendar.

    hide – .datepicker(“ hide”,[speed])隐藏先前打开的日历。

  • show – .datepicker(“show”) opens the calendar.

    show – .datepicker(“ show”)打开日历。

  • getDate – .datepicker(“getDate”) the method returns the date which was selected in the calendar.

    getDate – .datepicker(“ getDate”)方法返回在日历中选择的日期。

  • setDate – .datepicker(“setDate”, date) method allows you to set the date in the calendar. The value of the argument date can be a string (e.g.: 25.10.1917).

    setDate – .datepicker(“ setDate”,date)方法允许您设置日历中的日期。 参数date的值可以是字符串(例如:25.10.1917)。

翻译自: https://www.script-tutorials.com/datepicker-jquery-ui/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值