需要禁用引导时间选择器的输入 [英] need to disable input for bootstrap timepicker
本文介绍了需要禁用引导时间选择器的输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 Bootstrap 时间选择器.我已经成功地实现了它.但我需要的是用户只能插入 30 分钟的间隔,例如:10:00,10:30,11:00 等.为此我尝试了 minuteStep
如下所示,它完美运行.
I am using Bootstrap time-picker. I have successfully implemented it. But what I need is user is only able to insert in 30 min gap like: 10:00,10:30,11:00 etc. For that I have tried is minuteStep
as shown below, and it works perfect.
$('#fantasyleague-draft_time').timepicker({
template: false,
showInputs: false,
minuteStep: 30
});
但问题是用户可以根据需要输入时间.那么,如何防止它手动输入时间?
But what is the issue is user can type time as he need. So, how to prevent it to enter time manually?
为此,我参考了 bootstrap timepicker
推荐答案
到目前为止我所做的是:
What i have done so far now is :
<input type="text" id="fantasyleague-draft_time" readonly>
添加了 CSS
fantasyleague-draft_time{cursor: pointer;}
和JS:
$('#fantasyleague-draft_time').timepicker({
template: false,
showInputs: false,
minuteStep: 30
});
这篇关于需要禁用引导时间选择器的输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文