使用datetimepicker禁用输入字段(Disable input field with datetimepicker)

系统教程 行业动态 更新时间:2024-06-14 16:58:30
使用datetimepicker禁用输入字段(Disable input field with datetimepicker)

我的bootstrap datetimepicker有以下html。 我想禁用<input>并强制用户使用datetimepicker。 我尝试过使用disabled和readonly="readonly"属性。 但添加属性后,我的datetimepicker不起作用。 有什么建议?

<div class='input-group date' id='startDate'> <input type='text' class="form-control" /> <span class="input-group-addon"> <span class="glyphicon glyphicon-calendar"></span> </span> </div> $('#startDate').datetimepicker({ format: "YYYY-MM-DD", useCurrent: true, viewMode: "days" });

I have the following html for my bootstrap datetimepicker. I want to disable the <input> and force the user to make use of the datetimepicker. I've tried using disabled and readonly="readonly" attribute. But after adding the attribute, my datetimepicker doesn't work. Any suggestions?

<div class='input-group date' id='startDate'> <input type='text' class="form-control" /> <span class="input-group-addon"> <span class="glyphicon glyphicon-calendar"></span> </span> </div> $('#startDate').datetimepicker({ format: "YYYY-MM-DD", useCurrent: true, viewMode: "days" });

最满意答案

您可以将disabled属性添加到输入中,如:

<input type='text' class="form-control" name="startDate" disabled />

演示: http : //jsfiddle.net/IrvinDominin/hz6xuu0o/

You can add the disabled attribute to your input like:

<input type='text' class="form-control" name="startDate" disabled />

Demo: http://jsfiddle.net/IrvinDominin/hz6xuu0o/

更多推荐

本文发布于:2023-04-15 03:26:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/a24aa86cd6d728cd84d59370e990e8bb.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:字段   datetimepicker   Disable   field   input

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!