gpt4 book ai didi

jquery-ui - 如何将按钮添加到按钮面板中的 jQuery 日期选择器?

转载 作者:行者123 更新时间:2023-12-03 10:46:19 25 4
gpt4 key购买 nike

我是否只是将元素附加到面板包装器并调用 .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>", {
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( instance.input );
}
}).appendTo( buttonPane ).addClass("ui-datepicker-clear ui-state-default ui-priority-primary ui-corner-all");
}, 1 );
}
});

关于jquery-ui - 如何将按钮添加到按钮面板中的 jQuery 日期选择器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4598850/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com