使用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/
更多推荐
发布评论