jquery 日期时间选择器允许的时间为空
jquery datetime picker null allowed time
我的应用程序有时间动态绑定,其中场景可能允许时间可以为空,
在 Jquery 日期时间选择器设置中允许时间为 null 设置为此处显示的示例应该为 null
如何设置零时间?
$(document).ready(function(){
try{ $('.DATETIMEFIELD').datetimepicker({
value:'',
datepicker:false,
format:'h:i A',
formatTime: 'h:i A',
step:30 ,
allowTimes: [],
});
}
catch(e){
console.log(e);
};
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-datetimepicker/2.5.20/jquery.datetimepicker.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-datetimepicker/2.5.20/jquery.datetimepicker.full.js" id="_carbonads_js" defer></script>
<input type="text" class="DATETIMEFIELD">
如果数组为空,您可以销毁日期时间选择器。这两种情况都可以在 bing datetimepicker.
之前进行检查
$(document).ready(function(){
var timedata1=[32, 33, 12, 40]
var timedata2=[]
try{
$('.DATETIMEFIELD').datetimepicker({
value:'',
datepicker:false,
format:'h:i A',
formatTime: 'h:i A',
step:30 ,
allowTimes:timedata1,
});
if(timedata2.length==0 || timedata2==null){
$(".DATETIMEFIELD1").datepicker("destroy");
}else{
$('.DATETIMEFIELD1').datetimepicker({
value:'',
datepicker:false,
format:'h:i A',
formatTime: 'h:i A',
step:30 ,
allowTimes:timedata1,
});
}
}
catch(e){
console.log(e);
};
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-datetimepicker/2.5.20/jquery.datetimepicker.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-datetimepicker/2.5.20/jquery.datetimepicker.full.js" id="_carbonads_js" defer></script>
While Having Value
<input type="text" class="DATETIMEFIELD">
While not Having Value
<input type="text" class="DATETIMEFIELD1">
我的应用程序有时间动态绑定,其中场景可能允许时间可以为空,
在 Jquery 日期时间选择器设置中允许时间为 null 设置为此处显示的示例应该为 null
如何设置零时间?
$(document).ready(function(){
try{ $('.DATETIMEFIELD').datetimepicker({
value:'',
datepicker:false,
format:'h:i A',
formatTime: 'h:i A',
step:30 ,
allowTimes: [],
});
}
catch(e){
console.log(e);
};
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-datetimepicker/2.5.20/jquery.datetimepicker.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-datetimepicker/2.5.20/jquery.datetimepicker.full.js" id="_carbonads_js" defer></script>
<input type="text" class="DATETIMEFIELD">
如果数组为空,您可以销毁日期时间选择器。这两种情况都可以在 bing datetimepicker.
之前进行检查$(document).ready(function(){
var timedata1=[32, 33, 12, 40]
var timedata2=[]
try{
$('.DATETIMEFIELD').datetimepicker({
value:'',
datepicker:false,
format:'h:i A',
formatTime: 'h:i A',
step:30 ,
allowTimes:timedata1,
});
if(timedata2.length==0 || timedata2==null){
$(".DATETIMEFIELD1").datepicker("destroy");
}else{
$('.DATETIMEFIELD1').datetimepicker({
value:'',
datepicker:false,
format:'h:i A',
formatTime: 'h:i A',
step:30 ,
allowTimes:timedata1,
});
}
}
catch(e){
console.log(e);
};
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-datetimepicker/2.5.20/jquery.datetimepicker.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-datetimepicker/2.5.20/jquery.datetimepicker.full.js" id="_carbonads_js" defer></script>
While Having Value
<input type="text" class="DATETIMEFIELD">
While not Having Value
<input type="text" class="DATETIMEFIELD1">