我需要为我的datepicker字段添加一些选项,我遵循文档,但是我需要处理一个定制的脚本,我需要一些javascript的帮助。
这就是我写的剧本
HTML:
<div class="form-group col-md-6">
<label for="name">StartDate</label>
<input type="date" class="form-control" name="startdate" placeholder="Start Date" value="04/03/2018">
</div>JavaScript:
$('.form-group input[type=date]').each(function (idx, elt) {
if (elt.type != 'date' || elt.hasAttribute('data-datepicker')) {
elt.type = 'text';
$(elt).datetimepicker($(elt).data('datepicker'));
}
});我试着补充:
$(elt).datetimepicker({
locale: 'it',
format: 'DD/MM/YYYY'
});设置格式和区域设置,但不起作用。
发布于 2018-03-04 14:37:01
你想读的文件在哪里?
似乎您没有遵循引导程序3数据报童v4 Docs
请参阅https://eonasdan.github.io/bootstrap-datetimepicker/
你可以试试:
(HTML)
<div class='input-group date' id='datetimepicker1'>
<input type='text' class="form-control" />
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>(联合来文)
$('#datetimepicker1').datetimepicker({
format: 'DD/MM/YYYY',
locate: 'it'
});配置显示格式并定位。
https://stackoverflow.com/questions/49096192
复制相似问题