twitter-bootstrap 从引导输入字段更改占位符日期
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19758815/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
change the placeholder date from bootstrap input field
提问by Patrick
I am styling a form with bootstrap. I have an input field where I want the user to insert a date. The HTML is coded this way:
我正在使用引导程序设计表单。我有一个输入字段,我希望用户在其中插入日期。HTML 是这样编码的:
<div class="form-group">
<label for="entry_date">Date of entry:</label>
<input type="date" name='entry_date' class="form-control" id="entry_date"
<span class="help-block">Some helpful words here</span>
</div>
Bootstrap populates this field automatically with a placeholder which says dd/mm/yyyy.
How can I overwrite this? I need it so I can repopulate the field (eg. when reloading the form after a partial submission)
Bootstrap 使用占位符自动填充此字段,该占位符显示dd/mm/yyyy. 我怎样才能覆盖这个?我需要它以便我可以重新填充该字段(例如,在部分提交后重新加载表单时)
回答by JasonB
It's not a bootstrap problem, it's the new HTML5 date-input control
这不是引导程序问题,而是新的 HTML5 日期输入控件
Just use the value attribute as below:
只需使用 value 属性如下:
<input type="date" name='entry_date' class="form-control" id="entry_date" value="2012-12-12">
Other attributes are documented on the W3C page here
其他属性记录在W3C 页面上

