[英]How to disable and enable datetimepicker jquery plugin
I have a requirement like enabling and disabling datetimepicker plugin from input box.我有一个要求,比如从输入框中启用和禁用datetimepicker插件。
<select id="sel">
<option value="opt1" data-type="date">opt1</option>
<option value="opt2" data-type="string">opt2</option>
</input><input id="inp">
<script>
$('#sel').on('change', function(){
var type = $('this').find('option:selected').data(type);
if(type == 'date'){
//enable calendar
$('#inp').datetimepicker();
} else {
//need to disable
}
});
</script>
Want to enable if type is date if not need to disable calendar.如果不需要禁用日历,则想要启用如果类型是日期。 Any help appreciable.
任何帮助可观。
If you'll find time and read datetimepicker
manual you will see a couple of methods even with examples:如果您找到时间并阅读
datetimepicker
手册,即使有示例,您也会看到几种方法:
hide
- Hide Datetimepicker hide
- 隐藏日期时间选择器
toggle
- Show/Hide Datetimepicker toggle
- 显示/隐藏日期时间选择器
destroy
- Destroy datetimepicker destroy
- 销毁日期时间选择器
Now, choose which one you want.现在,选择你想要的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.