JQUERY-UI:日期选择器-禁用日点击事件 [英] JQUERY-UI: Datepicker - Disable day click event

查看:124
本文介绍了JQUERY-UI:日期选择器-禁用日点击事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前有一个日期选择器,其月份和年份更改设置为true ...但是作为我的用户体验报告反馈的一部分,他们不喜欢选择日期时自动关闭日期选择器,因为有时会更改日期按月,日和年的随机选择顺序.因此,例如,如果他们先更改日期,然后选择月",然后选择天",则日期选择器将自动关闭,而年份保持不变.

I currently have a datepicker with month and year change set to true... but as part of my user-experience report feedbacks, they didn't like the datepicker automatically closing when they select the day because sometimes they change the date in random order of selection from month, day, and year. So if for instance, they changed the date selecting Month first, then Day, the datepicker automatically closes already with the Year left unchanged.

所以我一直在寻找带有日期更改程序的日期选择器,只是设置值而不触发close事件,而只是在showButtonPanel设置为true时才将关闭事件委托给Done按钮.

So I was looking for something like a datepicker with the day changer just setting values and not triggering a close event and just delegating that close event to the Done button alone when showButtonPanel is set to true.

有什么想法我将如何实现?

Any ideas how I would achieve that?

这是我的代码段:

<script type="text/javascript">
$(function() {
    $('#datepicker').datepicker({
        changeMonth: true,
        changeYear: true,
  showButtonPanel: true,
  yearRange: 'c-70:c+nn'
    });
});

推荐答案

尝试一下(我假设您使用的是jqueryui datepicker):

try this (I assume you are using jqueryui datepicker):

$(function() {
        $('#datepicker').datepicker({
           onSelect: function(dateText, inst) { inst.show() }
        });
    });

这篇关于JQUERY-UI:日期选择器-禁用日点击事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆