jQuery clockInput:禁用时钟时间选择器
jQuery clockInput: Disable Clock Time Picker
我正在使用jQuery clockInput: Clock Time Picker
我想要的,在某些情况下我不需要设置时间,所以在那种情况下我想禁用时间选择并设置我设置的默认时间。
这是我使用的 link https://www.jqueryscript.net/time-clock/Clock-Time-Input-Plugin-jQuery-clockInput.html
时钟的简单代码:
$(document).ready(function() {
$("input[type=time]").clockInput(false);
});
我该怎么做?
这个plugin没有这个选项,这意味着作者没有提供制作它的选项disable
但是你可以做你自己通过一个简单的 css
属性。只需设置 data-disabled="disabled"
属性。
$(document).ready(function() {
$("input[type=time]").clockInput(false);
});
input[data-disabled="disabled"]+.jq-ci {
pointer-events: none;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://www.jqueryscript.net/demo/Clock-Time-Input-Plugin-jQuery-clockInput/jquery.clockinput.js"></script>
<link href="https://www.jqueryscript.net/demo/Clock-Time-Input-Plugin-jQuery-clockInput/jquery.clockinput.css" rel="stylesheet" />
<input type="time" data-disabled="disabled" value="14:30:00" />
我正在使用jQuery clockInput: Clock Time Picker
我想要的,在某些情况下我不需要设置时间,所以在那种情况下我想禁用时间选择并设置我设置的默认时间。
这是我使用的 link https://www.jqueryscript.net/time-clock/Clock-Time-Input-Plugin-jQuery-clockInput.html
时钟的简单代码:
$(document).ready(function() {
$("input[type=time]").clockInput(false);
});
我该怎么做?
这个plugin没有这个选项,这意味着作者没有提供制作它的选项disable
但是你可以做你自己通过一个简单的 css
属性。只需设置 data-disabled="disabled"
属性。
$(document).ready(function() {
$("input[type=time]").clockInput(false);
});
input[data-disabled="disabled"]+.jq-ci {
pointer-events: none;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://www.jqueryscript.net/demo/Clock-Time-Input-Plugin-jQuery-clockInput/jquery.clockinput.js"></script>
<link href="https://www.jqueryscript.net/demo/Clock-Time-Input-Plugin-jQuery-clockInput/jquery.clockinput.css" rel="stylesheet" />
<input type="time" data-disabled="disabled" value="14:30:00" />