jQuery 日期选择器多选和取消选择

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17651766/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 19:41:23  来源:igfitidea点击:

jQuery date picker multi select and unselect

jquerydatepicker

提问by dev1234

Is it possible to enable jquery UI (datepicker) to enable multi select and unselect ?

是否可以启用 jquery UI (datepicker) 以启用多选和取消选择?

example of datepicker i am using. http://jqueryui.com/datepicker/

我正在使用的日期选择器示例。http://jqueryui.com/datepicker/

i have got a requirement as to enable a datepicker to select multiple dates and i am wondering how to implement a similar one. Your prompt reply is greatly appreciated. Please give me some examples Thanks

我有一个要求让日期选择器能够选择多个日期,我想知道如何实现一个类似的日期。非常感谢您的及时答复。请给我一些例子谢谢

回答by Praveen

Multidatespickris a little plugin that enables jQuery UI calendar to manage multiple dates.

Multidatespickr是一个小插件,它使 jQuery UI 日历能够管理多个日期。

Features:

特征:

  • Select date ranges.
  • Pick multiple dates not in secuence.
  • Define a maximum number of pickable dates.
  • Define a range X days from where it is possible to select Y dates.
  • Define unavailable dates.
  • 选择日期范围。
  • 选择不连续的多个日期。
  • 定义可选取日期的最大数量。
  • 定义可以选择 Y 日期的 X 天范围。
  • 定义不可用日期。

HTML:

HTML:

<link rel="stylesheet" type="text/css" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"/>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"/>
<script src="http://multidatespickr.sourceforge.net/jquery-ui.multidatespicker.js"/>

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

JS:

JS:

$(document).ready(function(){
    $('#datePick').multiDatesPicker();
});

OR

或者

jQuery(document).ready(function(){
    jQuery('#datePick').multiDatesPicker();
});

Check this JSFiddle.

检查这个JSFiddle

回答by Sourav301

Try this Kendo UI CalenderKendo UI is an implementation of javascript.

试试这个 Kendo UI 日历Kendo UI 是 JavaScript 的一个实现。