jquery ui datepicker 下一年和上一年 [英] jquery ui datepicker next and previous year

查看:21
本文介绍了jquery ui datepicker 下一年和上一年的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在标准的 jquery.ui.datepicker 小部件上,只有一个用于选择月份的下一个和上一个按钮.如果我启用年份,它将显示在选择框中.

On the standard jquery.ui.datepicker widget there's only a next and previous button for selecting a month. If I enable year, it will be displayed in a select box.

在日历的两侧实现两个按钮的好方法是什么?一个用于选择下个月,一个用于选择明年,在右侧彼此相邻显示,当然左侧的前一个按钮也是如此.

What would be a good way to implement two buttons on both sides of the calendar? One for selecting next month and one for selecting next year, displayed next to each other on the right side, and do the same for the previous buttons on the left side of course.

$(function() {
  $("#dp").datepicker({changeYear: true});
})

推荐答案

我发现的最佳解决方案是将 Leniel 的答案与其他一些属性结合起来,这是我的日期元素的代码

The best solution I have found is to combine Leniel's answer with some other properties, here is the code I have for my date elements

jQuery(document).ready(function(){
    jQuery('input.date').each(function(){
        jQuery(this).datepicker({dateFormat:'dd/mm/yy', changeMonth: true,    stepMonths: 12, showAnim:"slideDown" });
        jQuery('#ui-datepicker-div .ui-helper-hidden-accessible').css("position", "absolute !important");
        jQuery('#ui-datepicker-div').css('clip', 'auto');
    });

希望这对别人和我一样有帮助!

Hope this helps someone else as much as it did me!

附言其他的东西是让日期选择器在所有浏览器中工作(ie6+,ff3+,chrome4+,safari,opera)

P.S. The other stuff is so that the datepicker works in all browsers (ie6+,ff3+,chrome4+,safari,opera)

这篇关于jquery ui datepicker 下一年和上一年的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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