jQuery   发布时间:2022-04-19  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了jquery-ui – 如何在按钮面板中将按钮添加到jQuery datepicker?大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我只是将元素附加到面板包装器并调用.button()?

解决方法

如果要在滚动月份期间保持“清除”按钮,请使用onChangeMonthYear:。

一个例子:

$( "#datepicker" ).datepicker({
    showButtonPanel: true,beforeShow: function( input ) {
        setTimeout(function() {
            var buttonPane = $( input )
                .datepicker( "widget" )
                .find( ".ui-datepicker-buttonpane" );

            $( "<button>",{
                text: "Clear",click: function() {
                //Code to clear your date field (text Box,read only field etc.) I had to remove the line below and add custom code here
                    $.datepicker._clearDate( input );
                }
            }).appendTo( buttonPane ).addClass("ui-datepicker-clear ui-state-default ui-priority-priMary ui-corner-all");
        },1 );
    },onChangeMonthYear: function( year,month,instance ) {
        setTimeout(function() {
            var buttonPane = $( instance )
                .datepicker( "widget" )
                .find( ".ui-datepicker-buttonpane" );

            $( "<button>",read only field etc.) I had to remove the line below and add custom code here
                    $.datepicker._clearDate( instance.input );
                }
            }).appendTo( buttonPane ).addClass("ui-datepicker-clear ui-state-default ui-priority-priMary ui-corner-all");
        },1 );
    }
});

大佬总结

以上是大佬教程为你收集整理的jquery-ui – 如何在按钮面板中将按钮添加到jQuery datepicker?全部内容,希望文章能够帮你解决jquery-ui – 如何在按钮面板中将按钮添加到jQuery datepicker?所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。