[英]How to prevent opening datepicker after choosing a date?
Datepicker keeps on opening after selecting a date, how to prevent opening datepicker after choosing the date? 选择日期后Datepicker会继续打开,如何防止选择日期后打开Datepicker?
$("#dateload").datepicker({
dateFormat: 'mm-dd-yy'
});
I tried with autoclose property to true but did not worked. 我尝试将autoclose属性设置为true,但没有用。 I also tried with on change event to hide the datepicker, also not worked.
我还尝试了on change事件来隐藏datepicker,也没有用。
I would go with this. 我会同意这一点。 (Demo here: http://codepen.io/8odoros/pen/OmNMVy )
(此处的演示: http : //codepen.io/8odoros/pen/OmNMVy )
$( "#dateload" ).datepicker({
dateFormat: 'mm-dd-yy',
onSelect:function(){
if($(this).datepicker("getDate")) $(this).datepicker("destroy");
}
});
Try to use this on change
event handler. 尝试在
change
事件处理程序上使用它。
$('#dateload').datepicker({
format: 'mm-dd-yy'
}).on('change', function(){
$('#dateload ~ .ui-datepicker').hide();
});
You can try to hide the dates after date changes like this 您可以尝试像这样更改日期后隐藏日期
$('#dateload').datepicker({
format: 'mm-dd-yy'
}).on('change', function(){
$('.datepicker').hide();
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.