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

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

问题描述

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



在日历两边实现两个按钮是一个好办法?一个用于选择下个月,一个用于选择明年,在右侧相互显示,并对左侧的以前的按钮进行相同的操作。

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


解决方案

发现是将Leniel的答案与一些其他属性相结合,这里是我的日期元素的代码

  jQuery(document)每个(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! ;
jQuery('#ui-datepicker-div')。css('clip','auto');
});

希望这样可以帮助别人尽可能多!



PS其他的东西是这样的,适用于所有浏览器(ie6 +,ff3 +,chrome4 +,safari,opera)


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});
})

解决方案

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!

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天全站免登陆