javascript - Laravel-9 jQuery Timepicker 禁用特定时间如何?

标签 javascript jquery laravel timepicker

$(document).ready(function(){
    $('#time').timepicker({
    timeFormat: 'h:mm a',
    interval: 60,
    minTime: '9',
    maxTime: '4:00pm',
    defaultTime: '9',
    startTime: '9:00',
    dynamic: false,
    dropdown: true,
    scrollbar: true,
    });
});

如何从该 jQuery 时间选择器的选择中禁用/删除中午 12 点? 时间选择器.co

上午 9:00 10:00 AM 11:00 AM 1:00 PM 下午2:00 3:00 PM 下午4:00

最佳答案

            $(function() {
    $('#disableTimeRangesExample').timepicker({ 
        step: 60,
        minTime:'9:00 a' ,
        maxTime: '4:00 p',
        defaultTime: '9',
        startTime: '9:00 a',
        dynamic: false,
        dropdown: true,
        scrollbar: true,
        'disableTimeRanges': [['12:00pm','12:01pm'],] 
          });
    });
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<link href="https://www.jonthornton.com/jquery-timepicker/documentation-assets/bootstrap-datepicker.css" rel="stylesheet"/>
<script src="https://www.jonthornton.com/jquery-timepicker/documentation-assets/bootstrap-datepicker.js"></script>

<link href="https://www.jonthornton.com/jquery-timepicker/jquery.timepicker.css" rel="stylesheet"/>
<script src="https://www.jonthornton.com/jquery-timepicker/jquery.timepicker.js"></script>


<div class="demo">
<input id="disableTimeRangesExample" type="text" class="time ui-timepicker-input" autocomplete="off">
   </div>

您可以尝试使用 disableTimeRanges 选项在 jQuery Timepicker 中禁用下午 12 点到下午 12:01 的范围

$(function() {
$('#disableTimeRangesExample').timepicker({ 
step: 60,
minTime:'9:00 a' ,
maxTime: '4:00 p',
defaultTime: '9',
startTime: '9:00 a',
dynamic: false,
dropdown: true,
scrollbar: true,
disableTimeRanges': [['12:00pm','12:01pm']] 
      });
});

关于javascript - Laravel-9 jQuery Timepicker 禁用特定时间如何?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/75874362/

相关文章:

javascript - 将数据从 HTML5 存储存储到应用程序数据库面临困难

javascript - Strophe 注册插件

Javascript 正则表达式 - 用空格、逗号和括号分隔单词的分割字符串

javascript - 如何在 html5、css3 或 jQuery 中随着鼠标移动创建移动粒子?

php - 使用变量作为高度和宽度的值

php - 合并具有相同数量项目的 2 个数组 - php

javascript - 动态添加 css 文件到 head(在 IE 中优先级相反)

javascript - 如何让侧边栏停在某个 div 处?

php - 错误的 __DIR__ 魔术常量值

php - Laravel - 更新模型时更新另一个属性