datetimepicker multiple clicks on the input date picker does not display

First, familiarize yourself with some attribute settings and detailed explanations of datepicker: 

//js中的datepicker属性设置
$('.selectData').datepicker({
	autoclose: true, //自动关闭
	beforeShowDay: $.noop,    //在显示日期之前调用的函数
	calendarWeeks: false,     //是否显示今年是第几周
	clearBtn: false,          //显示清除按钮
	daysOfWeekDisabled: [],   //星期几不可选
	endDate: Infinity,        //日历结束日期
	forceParse: true,         //是否强制转换不符合格式的字符串
	format: 'yyyy-mm-dd',     //日期格式
	keyboardNavigation: true, //是否显示箭头导航
	language: 'cn',           //语言
	minViewMode: 0,
	orientation: "auto",      //方向
	rtl: false,
	startDate: -Infinity,     //日历开始日期
	startView: 0,             //开始显示
	todayBtn: false,          //今天按钮
	todayHighlight: false,    //今天高亮
	weekStart: 0              //星期几是开始
});

In the past two days, the date picker does not display when the input box is clicked multiple times (including the second click) in the datetimepicker. After consulting and testing many times, it is necessary to use the mouse to monitor the trigger. The specific method is as follows:

 /* 点击input框时加载监听事件*/
document.getElementsByName('input的name名称')[0].addEventListener('click',myfunc)
function myfunc(e){
    e.currentTarget.blur();
}

The above code must be placed behind the datetimepicker method, I hope everyone can learn from it or have a better way to propose it, and share it with everyone.

Guess you like

Origin blog.csdn.net/jianshou6442/article/details/81476578